Skip to content

[swiftc (41 vs. 5431)] Add crasher in swift::DiagnosticEngine::emitDiagnostic #6974

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 22, 2017
Merged

[swiftc (41 vs. 5431)] Add crasher in swift::DiagnosticEngine::emitDiagnostic #6974

merged 1 commit into from
Jan 22, 2017

Conversation

practicalswift
Copy link
Contributor

Add test case for crash triggered in swift::DiagnosticEngine::emitDiagnostic.

Current number of unresolved compiler crashers: 41 (5431 resolved)

/cc @jtbandes - just wanted to let you know that this crasher caused an assertion failure for the assertion false && "encountered %error in diagnostic text" added on 2016-11-19 by you in commit 3263569 :-)

Assertion failure in lib/AST/DiagnosticEngine.cpp (line 490):

Assertion `false && "encountered %error in diagnostic text"' failed.

When executing: void formatDiagnosticText(llvm::StringRef, ArrayRef<swift::DiagnosticArgument>, llvm::raw_ostream &)

Assertion context:

      Modifier = InText.substr(0, Length);
      InText = InText.substr(Length);
    }

    if (Modifier == "error") {
      assert(false && "encountered %error in diagnostic text");
      Out << StringRef("<<ERROR>>");
      break;
    }

    // Parse the optional argument list for a modifier, which is brace-enclosed.

Stack trace:

0 0x0000000003898168 llvm::sys::PrintStackTrace(llvm::raw_ostream&) (/path/to/swift/bin/swift+0x3898168)
1 0x00000000038988a6 SignalHandler(int) (/path/to/swift/bin/swift+0x38988a6)
2 0x00007f72dbbc53e0 __restore_rt (/lib/x86_64-linux-gnu/libpthread.so.0+0x113e0)
3 0x00007f72da52b428 gsignal /build/glibc-Qz8a69/glibc-2.23/signal/../sysdeps/unix/sysv/linux/raise.c:54:0
4 0x00007f72da52d02a abort /build/glibc-Qz8a69/glibc-2.23/stdlib/abort.c:91:0
5 0x00007f72da523bd7 __assert_fail_base /build/glibc-Qz8a69/glibc-2.23/assert/assert.c:92:0
6 0x00007f72da523c82 (/lib/x86_64-linux-gnu/libc.so.6+0x2dc82)
7 0x00000000013da017 formatDiagnosticText(llvm::StringRef, llvm::ArrayRef<swift::DiagnosticArgument>, llvm::raw_ostream&) (/path/to/swift/bin/swift+0x13da017)
8 0x00000000013d8df7 formatDiagnosticText(llvm::StringRef, llvm::ArrayRef<swift::DiagnosticArgument>, llvm::raw_ostream&) (/path/to/swift/bin/swift+0x13d8df7)
9 0x00000000013d80d0 swift::DiagnosticEngine::emitDiagnostic(swift::Diagnostic const&) (/path/to/swift/bin/swift+0x13d80d0)
10 0x00000000013d741f swift::DiagnosticEngine::flushActiveDiagnostic() (/path/to/swift/bin/swift+0x13d741f)
11 0x000000000130ab3e swift::ASTVisitor<(anonymous namespace)::AttributeChecker, void, void, void, void, void, void>::visit(swift::DeclAttribute*) (/path/to/swift/bin/swift+0x130ab3e)
12 0x0000000001309741 swift::TypeChecker::checkDeclAttributes(swift::Decl*) (/path/to/swift/bin/swift+0x1309741)
13 0x0000000001299530 (anonymous namespace)::DeclChecker::visit(swift::Decl*) (/path/to/swift/bin/swift+0x1299530)
14 0x00000000012a6b9b (anonymous namespace)::DeclChecker::visitClassDecl(swift::ClassDecl*) (/path/to/swift/bin/swift+0x12a6b9b)
15 0x00000000012993b4 (anonymous namespace)::DeclChecker::visit(swift::Decl*) (/path/to/swift/bin/swift+0x12993b4)
16 0x00000000012992e3 swift::TypeChecker::typeCheckDecl(swift::Decl*, bool) (/path/to/swift/bin/swift+0x12992e3)
17 0x00000000011afe05 swift::performTypeChecking(swift::SourceFile&, swift::TopLevelContext&, swift::OptionSet<swift::TypeCheckingFlags, unsigned int>, unsigned int, unsigned int) (/path/to/swift/bin/swift+0x11afe05)
18 0x0000000000f0b546 swift::CompilerInstance::performSema() (/path/to/swift/bin/swift+0xf0b546)
19 0x00000000004a4606 swift::performFrontend(llvm::ArrayRef<char const*>, char const*, void*, swift::FrontendObserver*) (/path/to/swift/bin/swift+0x4a4606)
20 0x00000000004638c7 main (/path/to/swift/bin/swift+0x4638c7)
21 0x00007f72da516830 __libc_start_main /build/glibc-Qz8a69/glibc-2.23/csu/../csu/libc-start.c:325:0
22 0x0000000000460f69 _start (/path/to/swift/bin/swift+0x460f69)

…agnostic

Add test case for crash triggered in `swift::DiagnosticEngine::emitDiagnostic`.

Current number of unresolved compiler crashers: 41 (5431 resolved)

/cc @jtbandes - just wanted to let you know that this crasher caused an assertion failure for the assertion `false && "encountered %error in diagnostic text"` added on 2016-11-19 by you in commit 3263569 :-)

Assertion failure in [`lib/AST/DiagnosticEngine.cpp (line 490)`](https://github.com/apple/swift/blob/e9dd8107a90126c17290f23434c07a46e45dc5d8/lib/AST/DiagnosticEngine.cpp#L490):

```
Assertion `false && "encountered %error in diagnostic text"' failed.

When executing: void formatDiagnosticText(llvm::StringRef, ArrayRef<swift::DiagnosticArgument>, llvm::raw_ostream &)
```

Assertion context:

```c++
      Modifier = InText.substr(0, Length);
      InText = InText.substr(Length);
    }

    if (Modifier == "error") {
      assert(false && "encountered %error in diagnostic text");
      Out << StringRef("<<ERROR>>");
      break;
    }

    // Parse the optional argument list for a modifier, which is brace-enclosed.
```
Stack trace:

```
0 0x0000000003898168 llvm::sys::PrintStackTrace(llvm::raw_ostream&) (/path/to/swift/bin/swift+0x3898168)
1 0x00000000038988a6 SignalHandler(int) (/path/to/swift/bin/swift+0x38988a6)
2 0x00007f72dbbc53e0 __restore_rt (/lib/x86_64-linux-gnu/libpthread.so.0+0x113e0)
3 0x00007f72da52b428 gsignal /build/glibc-Qz8a69/glibc-2.23/signal/../sysdeps/unix/sysv/linux/raise.c:54:0
4 0x00007f72da52d02a abort /build/glibc-Qz8a69/glibc-2.23/stdlib/abort.c:91:0
5 0x00007f72da523bd7 __assert_fail_base /build/glibc-Qz8a69/glibc-2.23/assert/assert.c:92:0
6 0x00007f72da523c82 (/lib/x86_64-linux-gnu/libc.so.6+0x2dc82)
7 0x00000000013da017 formatDiagnosticText(llvm::StringRef, llvm::ArrayRef<swift::DiagnosticArgument>, llvm::raw_ostream&) (/path/to/swift/bin/swift+0x13da017)
8 0x00000000013d8df7 formatDiagnosticText(llvm::StringRef, llvm::ArrayRef<swift::DiagnosticArgument>, llvm::raw_ostream&) (/path/to/swift/bin/swift+0x13d8df7)
9 0x00000000013d80d0 swift::DiagnosticEngine::emitDiagnostic(swift::Diagnostic const&) (/path/to/swift/bin/swift+0x13d80d0)
10 0x00000000013d741f swift::DiagnosticEngine::flushActiveDiagnostic() (/path/to/swift/bin/swift+0x13d741f)
11 0x000000000130ab3e swift::ASTVisitor<(anonymous namespace)::AttributeChecker, void, void, void, void, void, void>::visit(swift::DeclAttribute*) (/path/to/swift/bin/swift+0x130ab3e)
12 0x0000000001309741 swift::TypeChecker::checkDeclAttributes(swift::Decl*) (/path/to/swift/bin/swift+0x1309741)
13 0x0000000001299530 (anonymous namespace)::DeclChecker::visit(swift::Decl*) (/path/to/swift/bin/swift+0x1299530)
14 0x00000000012a6b9b (anonymous namespace)::DeclChecker::visitClassDecl(swift::ClassDecl*) (/path/to/swift/bin/swift+0x12a6b9b)
15 0x00000000012993b4 (anonymous namespace)::DeclChecker::visit(swift::Decl*) (/path/to/swift/bin/swift+0x12993b4)
16 0x00000000012992e3 swift::TypeChecker::typeCheckDecl(swift::Decl*, bool) (/path/to/swift/bin/swift+0x12992e3)
17 0x00000000011afe05 swift::performTypeChecking(swift::SourceFile&, swift::TopLevelContext&, swift::OptionSet<swift::TypeCheckingFlags, unsigned int>, unsigned int, unsigned int) (/path/to/swift/bin/swift+0x11afe05)
18 0x0000000000f0b546 swift::CompilerInstance::performSema() (/path/to/swift/bin/swift+0xf0b546)
19 0x00000000004a4606 swift::performFrontend(llvm::ArrayRef<char const*>, char const*, void*, swift::FrontendObserver*) (/path/to/swift/bin/swift+0x4a4606)
20 0x00000000004638c7 main (/path/to/swift/bin/swift+0x4638c7)
21 0x00007f72da516830 __libc_start_main /build/glibc-Qz8a69/glibc-2.23/csu/../csu/libc-start.c:325:0
22 0x0000000000460f69 _start (/path/to/swift/bin/swift+0x460f69)
```
@practicalswift
Copy link
Contributor Author

@swift-ci please test and merge

@swift-ci swift-ci merged commit 19ef6f3 into swiftlang:master Jan 22, 2017
@jtbandes
Copy link
Contributor

cc @slavapestov — this appears to be because the struct has a public specifier (so its getFormalAccess() is public) but it's inside an internal class (so its getEffectiveAccess() is internal).

https://github.com/apple/swift/blob/e9dd8107a90126c17290f23434c07a46e45dc5d8/lib/Sema/TypeCheckAttr.cpp#L1776-L1780

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