Skip to content

[swiftc (21 vs. 5389)] Add crasher in swift::NewMangling::Mangler::appendIdentifier(...) #6556

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
Jan 4, 2017
Merged

[swiftc (21 vs. 5389)] Add crasher in swift::NewMangling::Mangler::appendIdentifier(...) #6556

merged 1 commit into from
Jan 4, 2017

Conversation

practicalswift
Copy link
Contributor

Add test case for crash triggered in swift::NewMangling::Mangler::appendIdentifier(...).

Current number of unresolved compiler crashers: 21 (5389 resolved)

/cc @eeckstein - just wanted to let you know that this crasher caused an assertion failure for the assertion !isDigit(ident[Pos]) && "first char of sub-string may not be a digit" added on 2016-12-02 by you in commit 684092d :-)

Assertion failure in include/swift/Basic/ManglingUtils.h (line 187):

Assertion `!isDigit(ident[Pos]) && "first char of sub-string may not be a digit"' failed.

When executing: void swift::NewMangling::mangleIdentifier(Mangler &, llvm::StringRef) [Mangler = swift::NewMangling::Mangler]

Assertion context:

      // Mangle the sub-string up to the next word substitution (or to the end
      // of the identifier - that's why we added the dummy-word).
      // The first thing: we add the encoded sub-string length.
      M.Buffer << (Repl.StringPos - Pos);
      assert(!isDigit(ident[Pos]) &&
             "first char of sub-string may not be a digit");
      do {
        // Update the start position of new added words, so that they refer to
        // the begin of the whole mangled Buffer.
        if (WordsInBuffer < M.Words.size() &&
            M.Words[WordsInBuffer].start == Pos) {

Stack trace:

0 0x0000000003512118 llvm::sys::PrintStackTrace(llvm::raw_ostream&) (/path/to/swift/bin/swift+0x3512118)
1 0x0000000003512856 SignalHandler(int) (/path/to/swift/bin/swift+0x3512856)
2 0x00007f97fd01b3e0 __restore_rt (/lib/x86_64-linux-gnu/libpthread.so.0+0x113e0)
3 0x00007f97fb749428 gsignal /build/glibc-Qz8a69/glibc-2.23/signal/../sysdeps/unix/sysv/linux/raise.c:54:0
4 0x00007f97fb74b02a abort /build/glibc-Qz8a69/glibc-2.23/stdlib/abort.c:91:0
5 0x00007f97fb741bd7 __assert_fail_base /build/glibc-Qz8a69/glibc-2.23/assert/assert.c:92:0
6 0x00007f97fb741c82 (/lib/x86_64-linux-gnu/libc.so.6+0x2dc82)
7 0x0000000000efb1ec void swift::NewMangling::mangleIdentifier<swift::NewMangling::Mangler>(swift::NewMangling::Mangler&, llvm::StringRef) (/path/to/swift/bin/swift+0xefb1ec)
8 0x0000000000efa72d swift::NewMangling::Mangler::appendIdentifier(llvm::StringRef) (/path/to/swift/bin/swift+0xefa72d)
9 0x0000000000dcef51 swift::NewMangling::ASTMangler::appendDeclName(swift::ValueDecl const*) (/path/to/swift/bin/swift+0xdcef51)
10 0x0000000000dcbbc6 swift::NewMangling::ASTMangler::appendEntity(swift::ValueDecl const*, llvm::StringRef, bool) (/path/to/swift/bin/swift+0xdcbbc6)
11 0x0000000000dccb0e swift::NewMangling::ASTMangler::mangleGlobalVariableFull[abi:cxx11](swift::VarDecl const*) (/path/to/swift/bin/swift+0xdccb0e)
12 0x00000000006694b5 swift::Lowering::SILGenModule::getSILGlobalVariable(swift::VarDecl*, swift::ForDefinition_t) (/path/to/swift/bin/swift+0x6694b5)
13 0x000000000063a3e5 swift::Lowering::SILGenFunction::emitInitializationForVarDecl(swift::VarDecl*) (/path/to/swift/bin/swift+0x63a3e5)
14 0x000000000063c0a1 swift::ASTVisitor<(anonymous namespace)::InitializationForPattern, void, void, void, std::unique_ptr<swift::Lowering::Initialization, std::default_delete<swift::Lowering::Initialization> >, void, void>::visit(swift::Pattern*) (/path/to/swift/bin/swift+0x63c0a1)
15 0x000000000063b164 swift::Lowering::SILGenFunction::emitPatternBinding(swift::PatternBindingDecl*, unsigned int) (/path/to/swift/bin/swift+0x63b164)
16 0x000000000063b2dd swift::Lowering::SILGenFunction::visitPatternBindingDecl(swift::PatternBindingDecl*) (/path/to/swift/bin/swift+0x63b2dd)
17 0x000000000061e0ac swift::Lowering::SILGenModule::visitTopLevelCodeDecl(swift::TopLevelCodeDecl*) (/path/to/swift/bin/swift+0x61e0ac)
18 0x000000000061e96b swift::Lowering::SILGenModule::emitSourceFile(swift::SourceFile*, unsigned int) (/path/to/swift/bin/swift+0x61e96b)
19 0x000000000061f95b swift::SILModule::constructSIL(swift::ModuleDecl*, swift::SILOptions&, swift::FileUnit*, llvm::Optional<unsigned int>, bool, bool) (/path/to/swift/bin/swift+0x61f95b)
20 0x000000000061ffb5 swift::performSILGeneration(swift::FileUnit&, swift::SILOptions&, llvm::Optional<unsigned int>, bool) (/path/to/swift/bin/swift+0x61ffb5)
21 0x000000000047e7a5 swift::performFrontend(llvm::ArrayRef<char const*>, char const*, void*, swift::FrontendObserver*) (/path/to/swift/bin/swift+0x47e7a5)
22 0x000000000043ade7 main (/path/to/swift/bin/swift+0x43ade7)
23 0x00007f97fb734830 __libc_start_main /build/glibc-Qz8a69/glibc-2.23/csu/../csu/libc-start.c:325:0
24 0x0000000000438229 _start (/path/to/swift/bin/swift+0x438229)

…pendIdentifier(...)

Add test case for crash triggered in `swift::NewMangling::Mangler::appendIdentifier(...)`.

Current number of unresolved compiler crashers: 21 (5389 resolved)

/cc @eeckstein - just wanted to let you know that this crasher caused an assertion failure for the assertion `!isDigit(ident[Pos]) && "first char of sub-string may not be a digit"` added on 2016-12-02 by you in commit 684092d :-)

Assertion failure in [`include/swift/Basic/ManglingUtils.h (line 187)`](https://github.com/apple/swift/blob/master/include/swift/Basic/ManglingUtils.h#L187):

```
Assertion `!isDigit(ident[Pos]) && "first char of sub-string may not be a digit"' failed.

When executing: void swift::NewMangling::mangleIdentifier(Mangler &, llvm::StringRef) [Mangler = swift::NewMangling::Mangler]
```

Assertion context:

```
      // Mangle the sub-string up to the next word substitution (or to the end
      // of the identifier - that's why we added the dummy-word).
      // The first thing: we add the encoded sub-string length.
      M.Buffer << (Repl.StringPos - Pos);
      assert(!isDigit(ident[Pos]) &&
             "first char of sub-string may not be a digit");
      do {
        // Update the start position of new added words, so that they refer to
        // the begin of the whole mangled Buffer.
        if (WordsInBuffer < M.Words.size() &&
            M.Words[WordsInBuffer].start == Pos) {
```
Stack trace:

```
0 0x0000000003512118 llvm::sys::PrintStackTrace(llvm::raw_ostream&) (/path/to/swift/bin/swift+0x3512118)
1 0x0000000003512856 SignalHandler(int) (/path/to/swift/bin/swift+0x3512856)
2 0x00007f97fd01b3e0 __restore_rt (/lib/x86_64-linux-gnu/libpthread.so.0+0x113e0)
3 0x00007f97fb749428 gsignal /build/glibc-Qz8a69/glibc-2.23/signal/../sysdeps/unix/sysv/linux/raise.c:54:0
4 0x00007f97fb74b02a abort /build/glibc-Qz8a69/glibc-2.23/stdlib/abort.c:91:0
5 0x00007f97fb741bd7 __assert_fail_base /build/glibc-Qz8a69/glibc-2.23/assert/assert.c:92:0
6 0x00007f97fb741c82 (/lib/x86_64-linux-gnu/libc.so.6+0x2dc82)
7 0x0000000000efb1ec void swift::NewMangling::mangleIdentifier<swift::NewMangling::Mangler>(swift::NewMangling::Mangler&, llvm::StringRef) (/path/to/swift/bin/swift+0xefb1ec)
8 0x0000000000efa72d swift::NewMangling::Mangler::appendIdentifier(llvm::StringRef) (/path/to/swift/bin/swift+0xefa72d)
9 0x0000000000dcef51 swift::NewMangling::ASTMangler::appendDeclName(swift::ValueDecl const*) (/path/to/swift/bin/swift+0xdcef51)
10 0x0000000000dcbbc6 swift::NewMangling::ASTMangler::appendEntity(swift::ValueDecl const*, llvm::StringRef, bool) (/path/to/swift/bin/swift+0xdcbbc6)
11 0x0000000000dccb0e swift::NewMangling::ASTMangler::mangleGlobalVariableFull[abi:cxx11](swift::VarDecl const*) (/path/to/swift/bin/swift+0xdccb0e)
12 0x00000000006694b5 swift::Lowering::SILGenModule::getSILGlobalVariable(swift::VarDecl*, swift::ForDefinition_t) (/path/to/swift/bin/swift+0x6694b5)
13 0x000000000063a3e5 swift::Lowering::SILGenFunction::emitInitializationForVarDecl(swift::VarDecl*) (/path/to/swift/bin/swift+0x63a3e5)
14 0x000000000063c0a1 swift::ASTVisitor<(anonymous namespace)::InitializationForPattern, void, void, void, std::unique_ptr<swift::Lowering::Initialization, std::default_delete<swift::Lowering::Initialization> >, void, void>::visit(swift::Pattern*) (/path/to/swift/bin/swift+0x63c0a1)
15 0x000000000063b164 swift::Lowering::SILGenFunction::emitPatternBinding(swift::PatternBindingDecl*, unsigned int) (/path/to/swift/bin/swift+0x63b164)
16 0x000000000063b2dd swift::Lowering::SILGenFunction::visitPatternBindingDecl(swift::PatternBindingDecl*) (/path/to/swift/bin/swift+0x63b2dd)
17 0x000000000061e0ac swift::Lowering::SILGenModule::visitTopLevelCodeDecl(swift::TopLevelCodeDecl*) (/path/to/swift/bin/swift+0x61e0ac)
18 0x000000000061e96b swift::Lowering::SILGenModule::emitSourceFile(swift::SourceFile*, unsigned int) (/path/to/swift/bin/swift+0x61e96b)
19 0x000000000061f95b swift::SILModule::constructSIL(swift::ModuleDecl*, swift::SILOptions&, swift::FileUnit*, llvm::Optional<unsigned int>, bool, bool) (/path/to/swift/bin/swift+0x61f95b)
20 0x000000000061ffb5 swift::performSILGeneration(swift::FileUnit&, swift::SILOptions&, llvm::Optional<unsigned int>, bool) (/path/to/swift/bin/swift+0x61ffb5)
21 0x000000000047e7a5 swift::performFrontend(llvm::ArrayRef<char const*>, char const*, void*, swift::FrontendObserver*) (/path/to/swift/bin/swift+0x47e7a5)
22 0x000000000043ade7 main (/path/to/swift/bin/swift+0x43ade7)
23 0x00007f97fb734830 __libc_start_main /build/glibc-Qz8a69/glibc-2.23/csu/../csu/libc-start.c:325:0
24 0x0000000000438229 _start (/path/to/swift/bin/swift+0x438229)
```
@practicalswift
Copy link
Contributor Author

@swift-ci please smoke test and merge

@practicalswift
Copy link
Contributor Author

@swift-ci please test and merge

@practicalswift practicalswift merged commit 146a537 into swiftlang:master Jan 4, 2017
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.

1 participant