Skip to content

[ClangImporter] fix crash when importing macros with bitwise operators #3629

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
Jul 21, 2016
Merged

[ClangImporter] fix crash when importing macros with bitwise operators #3629

merged 1 commit into from
Jul 21, 2016

Conversation

IngmarStein
Copy link
Contributor

What's in this pull request?

Fix an assertion which is triggered when the operands of a bitwise operator have different signedness. This is done by promoting the operands to the largest bit width (taking sign/zero extension into account) and ignoring the signedness for the operation itself.

Resolved assertion:

Assertion failed: (IsUnsigned == RHS.IsUnsigned && "Signedness mismatch!"), function operator&, file /Users/istein/Devel/llvm/include/llvm/ADT/APSInt.h, line 235.
0  swift-ide-test           0x0000000110fc590e llvm::sys::PrintStackTrace(llvm::raw_ostream&) + 46
1  swift-ide-test           0x0000000110fc5e39 PrintStackTraceSignalHandler(void*) + 25
2  swift-ide-test           0x0000000110fc21b9 llvm::sys::RunSignalHandlers() + 425
3  swift-ide-test           0x0000000110fc64b2 SignalHandler(int) + 354
4  libsystem_platform.dylib 0x00007fff96e2252a _sigtramp + 26
5  libsystem_platform.dylib 0x00007fff6bc0bac5 _sigtramp + 3571357109
6  swift-ide-test           0x0000000110fc5e5b raise + 27
7  swift-ide-test           0x0000000110fc5f02 abort + 18
8  swift-ide-test           0x0000000110fc5eee __assert_rtn + 126
9  swift-ide-test           0x000000010c8b017c llvm::APSInt::operator&(llvm::APSInt const&) const + 140
10 swift-ide-test           0x000000010c8adcfe importMacro(swift::ClangImporter::Implementation&, swift::DeclContext*, swift::Identifier, clang::MacroInfo const*, clang::MacroInfo const*, clang::QualType*) + 5358
11 swift-ide-test           0x000000010c8ac32d swift::ClangImporter::Implementation::importMacro(swift::Identifier, clang::MacroInfo*) + 957
12 swift-ide-test           0x000000010c7da588 swift::ClangImporter::Implementation::lookupValue(swift::SwiftLookupTable&, swift::DeclName, swift::VisibleDeclConsumer&) + 584
13 swift-ide-test           0x000000010c7d96fc swift::ClangImporter::Implementation::lookupVisibleDecls(swift::SwiftLookupTable&, swift::VisibleDeclConsumer&) + 364
14 swift-ide-test           0x000000010c7d98d9 swift::ClangModuleUnit::getTopLevelDecls(llvm::SmallVectorImpl<swift::Decl*>&) const + 345
15 swift-ide-test           0x000000010c7d9f74 swift::ClangModuleUnit::getDisplayDecls(llvm::SmallVectorImpl<swift::Decl*>&) const + 68
16 swift-ide-test           0x000000010cc2a7b3 swift::ModuleDecl::getDisplayDecls(llvm::SmallVectorImpl<swift::Decl*>&) const + 115
17 swift-ide-test           0x000000010bff088d swift::ide::printSubmoduleInterface(swift::ModuleDecl*, llvm::ArrayRef<llvm::StringRef>, llvm::ArrayRef<llvm::StringRef>, swift::OptionSet<swift::ide::ModuleTraversal, unsigned int>, swift::ASTPrinter&, swift::PrintOptions const&, bool) + 173
18 swift-ide-test           0x000000010be2b26f doPrintModules(swift::CompilerInvocation const&, std::__1::vector<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::allocator<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > > >, std::__1::vector<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::allocator<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > > >, swift::OptionSet<swift::ide::ModuleTraversal, unsigned int>, swift::PrintOptions const&, bool, bool) + 5967
19 swift-ide-test           0x000000010be1e991 main + 21137
20 libdyld.dylib            0x00007fff9a5fe5ad start + 1

Before merging this pull request to apple/swift repository:

  • Test pull request on Swift continuous integration.

Triggering Swift CI

The swift-ci is triggered by writing a comment on this PR addressed to the GitHub user @swift-ci. Different tests will run depending on the specific comment that you use. The currently available comments are:

Smoke Testing

Platform Comment
All supported platforms @swift-ci Please smoke test
All supported platforms @swift-ci Please smoke test and merge
OS X platform @swift-ci Please smoke test OS X platform
Linux platform @swift-ci Please smoke test Linux platform

A smoke test on macOS does the following:

  1. Builds the compiler incrementally.
  2. Builds the standard library only for macOS. Simulator standard libraries and
    device standard libraries are not built.
  3. lldb is not built.
  4. The test and validation-test targets are run only for macOS. The optimized
    version of these tests are not run.

A smoke test on Linux does the following:

  1. Builds the compiler incrementally.
  2. Builds the standard library incrementally.
  3. lldb is build incrementally.
  4. The swift test and validation-test targets are run. The optimized version of these
    tests are not run.
  5. lldb is tested.

Validation Testing

Platform Comment
All supported platforms @swift-ci Please test
All supported platforms @swift-ci Please test and merge
OS X platform @swift-ci Please test OS X platform
OS X platform @swift-ci Please benchmark
Linux platform @swift-ci Please test Linux platform

Lint Testing

Language Comment
Python @swift-ci Please Python lint

Note: Only members of the Apple organization can trigger swift-ci.

Fix an assertion which is triggered when the operands of a bitwise operator have different signedness.
This is done by promoting the operands to the largest bit width (taking sign/zero extension into account) and ignoring the signedness for the operation itself.

@IngmarStein
Copy link
Contributor Author

CC @jrose-apple

@DougGregor
Copy link
Member

LGTM

@swift-ci please smoke test and merge

@IngmarStein
Copy link
Contributor Author

Are the regressions on Linux (test-repl-glibc.py, TestSwiftAnyType.py) related?

Fix an assertion which is triggered when the operands of a bitwise operator have different signedness.
This is done by promoting the operands to the largest bit width (taking sign/zero extension into account) and ignoring the signedness for the operation itself.
@jrose-apple
Copy link
Contributor

@swift-ci Please smoke test

@DougGregor
Copy link
Member

Linux failure is unrelated AFAICT.

@DougGregor DougGregor merged commit 16e4785 into swiftlang:master Jul 21, 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.

3 participants