Skip to content

Runtime: Fix undersized allocation for out-of-line optional cast result. #4030

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Aug 5, 2016

Conversation

jckarter
Copy link
Contributor

@jckarter jckarter commented Aug 5, 2016

We accounted for the size difference between T and T? in the inline case, but not the out-of-line case. rdar://problem/27671131

We accounted for the size difference between T and T? in the inline case, but not the out-of-line case. rdar://problem/27671131
@jckarter
Copy link
Contributor Author

jckarter commented Aug 5, 2016

@swift-ci Please ASAN test

@jckarter
Copy link
Contributor Author

jckarter commented Aug 5, 2016

@rjmccall, Does this look good for Swift 3?

@gribozavr
Copy link
Contributor

Could you add a targeted test for this issue? Because it only broke in one test, we only have incidental coverage for this codepath.

@rjmccall
Copy link
Contributor

rjmccall commented Aug 5, 2016

Yes, this looks fine to me. I agree that it's easier to just unconditionally allocate an extra byte than to worry about whether there are extra inhabitants.

@jckarter
Copy link
Contributor Author

jckarter commented Aug 5, 2016

Yeah, it might be cleaner to summon the Optional<T> metadata and use its allocateBuffer witness to do this, but this seemed like a good minimal fix to get the bots clean again.

@gottesmm
Copy link
Contributor

gottesmm commented Aug 5, 2016

This needs tests.

@jckarter
Copy link
Contributor Author

jckarter commented Aug 5, 2016

It's exercised by the existing test suite. The tests that were failing on the ASAN bot appear to be passing now:

PASS: Swift(macosx-x86_64) :: stdlib/Dictionary.swift (8019 of 8482)
PASS: Swift(macosx-x86_64) :: stdlib/Set.swift (8056 of 8482)

@gottesmm
Copy link
Contributor

gottesmm commented Aug 5, 2016

@jckarter Ok on the test... On another note, I don't think that the PR asan test works now. I think xin was looking into it but it is not clear to me if it was fixed.

@trentxintong
Copy link
Contributor

I do not believe the ASAN external bots are fixed. Those are machines not controlled by us and the radar got pushed back because of WWDC and other releases.

@gribozavr
Copy link
Contributor

It's exercised by the existing test suite.

These is incidental coverage. If someone changes how the infrastructure of those tests work, we will lose this coverage.

@tkremenek
Copy link
Member

@swift-ci test

@tkremenek
Copy link
Member

@swift-ci test linux

1 similar comment
@tkremenek
Copy link
Member

@swift-ci test linux

@tkremenek
Copy link
Member

@swift-ci test os x

3 similar comments
@tkremenek
Copy link
Member

@swift-ci test os x

@tkremenek
Copy link
Member

@swift-ci test os x

@tkremenek
Copy link
Member

@swift-ci test os x

@tkremenek
Copy link
Member

ASAN testing timed out.

OS X testing failure may be infrastructure. Re-running with wiped workspace.

@tkremenek
Copy link
Member

From OS X:

/Users/buildnode/jenkins/workspace/swift-PR-osx/buildbot_incremental/swift-macosx-x86_64/test-iphonesimulator-i386/Serialization/Output/failed-clang-module.swift.tmp/MixModA.framework/Modules/module.modulemap:3:10: error: inferred submodules require a module with an umbrella
  module * { export * }
         ^
/Users/buildnode/jenkins/workspace/swift-PR-osx/buildbot_incremental/swift-macosx-x86_64/test-iphonesimulator-i386/Serialization/Output/failed-clang-module.swift.tmp/MixModA.framework/Modules/module.modulemap:3:10: error: inferred submodules require a module with an umbrella
  module * { export * }
         ^

@tkremenek
Copy link
Member

@swift-ci test os x platform

@jckarter
Copy link
Contributor Author

jckarter commented Aug 5, 2016

@tkremenek The ASAN bot at least tested the tests we were interested in. OS X is still failing on the same modulemap error, but that's almost definitely unrelated.

@jckarter
Copy link
Contributor Author

jckarter commented Aug 5, 2016

@gribozavr Crafting a test that would reliably fail outside of asan will also require depending on incidental details of the allocator, AFAICT.

@gribozavr
Copy link
Contributor

@jckarter I'm not asking for a test that would fail outside of ASan -- failing only under ASan is fine (that's why we have that bot); just for a test that would cover this codepath, and that is not an emergent behavior in other tests.

@jckarter jckarter merged commit 50af58b into swiftlang:master Aug 5, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants