Skip to content
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

[SR-8456] Abort trap when referencing malformed type as associated value of enum case #50977

Closed
swift-ci opened this issue Aug 3, 2018 · 1 comment
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. compiler The Swift compiler in itself crash Bug: A crash, i.e., an abnormal termination of software

Comments

@swift-ci
Copy link
Collaborator

swift-ci commented Aug 3, 2018

Previous ID SR-8456
Radar None
Original Reporter neightchan (JIRA User)
Type Bug
Status Resolved
Resolution Done
Additional Detail from JIRA
Votes 0
Component/s Compiler
Labels Bug, CompilerCrash
Assignee None
Priority Medium

md5: cbbf955df02f1dbfb3b156d72832e0ac

Issue Description:

In the Swift 4.2 snapshot from 2018/07/14, this code

enum Foo {
    case BigA {
    }
    case littleA(BigA)
}

results in the following abort trap:

CompileSwift normal x86_64 /path/to/main.swift (in target: TheProject)
    cd /Users/nate/projects/Scratchpads/TheProject
    /Library/Developer/Toolchains/swift-4.2-DEVELOPMENT-SNAPSHOT-2018-07-14-a.xctoolchain/usr/bin/swift -frontend -c -primary-file /path/to/main.swift -emit-module-path /path/to/TheProject-dobcmrverhdnmbaoppkndrntiijk/Build/Intermediates.noindex/TheProject.build/Debug/TheProject.build/Objects-normal/x86_64/main~partial.swiftmodule -emit-module-doc-path /path/to/TheProject-dobcmrverhdnmbaoppkndrntiijk/Build/Intermediates.noindex/TheProject.build/Debug/TheProject.build/Objects-normal/x86_64/main~partial.swiftdoc -serialize-diagnostics-path /path/to/TheProject-dobcmrverhdnmbaoppkndrntiijk/Build/Intermediates.noindex/TheProject.build/Debug/TheProject.build/Objects-normal/x86_64/main.dia -emit-dependencies-path /path/to/TheProject-dobcmrverhdnmbaoppkndrntiijk/Build/Intermediates.noindex/TheProject.build/Debug/TheProject.build/Objects-normal/x86_64/main.d -emit-reference-dependencies-path /path/to/TheProject-dobcmrverhdnmbaoppkndrntiijk/Build/Intermediates.noindex/TheProject.build/Debug/TheProject.build/Objects-normal/x86_64/main.swiftdeps -target x86_64-apple-macosx10.13 -enable-objc-interop -sdk /Applications/Xcode10Beta3.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk -I /path/to/TheProject-dobcmrverhdnmbaoppkndrntiijk/Build/Products/Debug -F /path/to/TheProject-dobcmrverhdnmbaoppkndrntiijk/Build/Products/Debug -enable-testing -g -module-cache-path /Users/nate/Library/Developer/Xcode/DerivedData/ModuleCache.noindex -swift-version 4.2 -enforce-exclusivity=checked -Onone -D DEBUG -serialize-debugging-options -Xcc -I/path/to/TheProject-dobcmrverhdnmbaoppkndrntiijk/Build/Intermediates.noindex/TheProject.build/Debug/TheProject.build/swift-overrides.hmap -Xcc -iquote -Xcc /path/to/TheProject-dobcmrverhdnmbaoppkndrntiijk/Build/Intermediates.noindex/TheProject.build/Debug/TheProject.build/TheProject-generated-files.hmap -Xcc -I/path/to/TheProject-dobcmrverhdnmbaoppkndrntiijk/Build/Intermediates.noindex/TheProject.build/Debug/TheProject.build/TheProject-own-target-headers.hmap -Xcc -I/path/to/TheProject-dobcmrverhdnmbaoppkndrntiijk/Build/Intermediates.noindex/TheProject.build/Debug/TheProject.build/TheProject-all-target-headers.hmap -Xcc -iquote -Xcc /path/to/TheProject-dobcmrverhdnmbaoppkndrntiijk/Build/Intermediates.noindex/TheProject.build/Debug/TheProject.build/TheProject-project-headers.hmap -Xcc -I/path/to/TheProject-dobcmrverhdnmbaoppkndrntiijk/Build/Products/Debug/include -Xcc -I/path/to/TheProject-dobcmrverhdnmbaoppkndrntiijk/Build/Intermediates.noindex/TheProject.build/Debug/TheProject.build/DerivedSources/x86_64 -Xcc -I/path/to/TheProject-dobcmrverhdnmbaoppkndrntiijk/Build/Intermediates.noindex/TheProject.build/Debug/TheProject.build/DerivedSources -Xcc -DDEBUG=1 -Xcc -working-directory/Users/nate/projects/Scratchpads/TheProject -module-name TheProject -o /path/to/TheProject-dobcmrverhdnmbaoppkndrntiijk/Build/Intermediates.noindex/TheProject.build/Debug/TheProject.build/Objects-normal/x86_64/main.o -index-store-path /path/to/TheProject-dobcmrverhdnmbaoppkndrntiijk/Index/DataStore -index-system-modules

/path/to/main.swift:10:14: error: consecutive declarations on a line must be separated by ';'
    case BigA {
             ^
             ;
/path/to/main.swift:10:15: error: expected declaration
    case BigA {
              ^
/path/to/main.swift:9:6: note: in declaration of 'Foo'
enum Foo {
     ^
/path/to/main.swift:12:18: error: use of undeclared type 'BigA'
    case littleA(BigA)
                 ^~~~
Can't demangle: $S30TheProject3FooO7littleAXeF
0  swift                    0x000000010a1ca8a8 llvm::sys::PrintStackTrace(llvm::raw_ostream&) + 40
1  swift                    0x000000010a1c9ae7 llvm::sys::RunSignalHandlers() + 39
2  swift                    0x000000010a1caf22 SignalHandler(int) + 258
3  libsystem_platform.dylib 0x00007fff5606df5a _sigtramp + 26
4  libsystem_platform.dylib 000000000000000000 _sigtramp + 2851676352
5  libsystem_c.dylib        0x00007fff55e0b1ae abort + 127
6  swift                    0x0000000107c7bb04 swift::Mangle::Mangler::verify(llvm::StringRef) + 980
7  swift                    0x0000000107b3f8ae swift::Mangle::ASTMangler::mangleDeclAsUSR(swift::ValueDecl const*, llvm::StringRef) + 478
8  swift                    0x0000000107c760c9 swift::ide::printDeclUSR(swift::ValueDecl const*, llvm::raw_ostream&) + 857
9  swift                    0x0000000107736189 (anonymous namespace)::IndexSwiftASTWalker::getNameAndUSR(swift::ValueDecl*, swift::ExtensionDecl*, llvm::StringRef&, llvm::StringRef&) + 505
10 swift                    0x0000000107735be2 (anonymous namespace)::IndexSwiftASTWalker::initIndexSymbol(swift::ValueDecl*, swift::SourceLoc, bool, swift::index::IndexSymbol&) + 178
11 swift                    0x0000000107734524 (anonymous namespace)::IndexSwiftASTWalker::walkToDeclPre(swift::Decl*, swift::CharSourceRange) + 2196
12 swift                    0x00000001075ac1d2 (anonymous namespace)::SemaAnnotator::walkToDeclPre(swift::Decl*) + 1378
13 swift                    0x0000000107b7b979 (anonymous namespace)::Traversal::doIt(swift::Decl*) + 185
14 swift                    0x0000000107b80c2b (anonymous namespace)::Traversal::visitNominalTypeDecl(swift::NominalTypeDecl*) + 475
15 swift                    0x0000000107b7b9e8 (anonymous namespace)::Traversal::doIt(swift::Decl*) + 296
16 swift                    0x0000000107b7b8ab swift::Decl::walk(swift::ASTWalker&) + 27
17 swift                    0x0000000107c2b2da swift::SourceFile::walk(swift::ASTWalker&) + 170
18 swift                    0x00000001075aa957 swift::SourceEntityWalker::walk(swift::SourceFile&) + 119
19 swift                    0x0000000107733a0b (anonymous namespace)::IndexSwiftASTWalker::visitModule(swift::ModuleDecl&, llvm::StringRef) + 235
20 swift                    0x0000000107733874 swift::index::indexSourceFile(swift::SourceFile*, llvm::StringRef, swift::index::IndexDataConsumer&) + 468
21 swift                    0x000000010773ba79 recordSourceFileUnit(swift::SourceFile*, llvm::StringRef, llvm::StringRef, bool, bool, llvm::StringRef, llvm::ArrayRef<clang::FileEntry const*>, clang::CompilerInstance const&, swift::DiagnosticEngine&) + 1657
22 swift                    0x000000010773b3ea swift::index::indexAndRecord(swift::SourceFile*, llvm::StringRef, llvm::StringRef, bool, bool, llvm::StringRef, swift::DependencyTracker const&) + 298
23 swift                    0x00000001069bd53c emitIndexDataIfNeeded(swift::SourceFile*, swift::CompilerInvocation const&, swift::CompilerInstance&) + 284
24 swift                    0x00000001069b2834 performCompile(swift::CompilerInstance&, swift::CompilerInvocation&, llvm::ArrayRef<char const*>, int&, swift::FrontendObserver*, swift::UnifiedStatsReporter*) + 6132
25 swift                    0x00000001069b0022 swift::performFrontend(llvm::ArrayRef<char const*>, char const*, void*, swift::FrontendObserver*) + 2946
26 swift                    0x000000010696a9ee main + 1134
27 libdyld.dylib            0x00007fff55d5f015 start + 1
28 libdyld.dylib            0x0000000000000042 start + 2854883374
Stack dump:
0.  Program arguments: /Library/Developer/Toolchains/swift-4.2-DEVELOPMENT-SNAPSHOT-2018-07-14-a.xctoolchain/usr/bin/swift -frontend -c -primary-file /path/to/main.swift -emit-module-path /path/to/TheProject-dobcmrverhdnmbaoppkndrntiijk/Build/Intermediates.noindex/TheProject.build/Debug/TheProject.build/Objects-normal/x86_64/main~partial.swiftmodule -emit-module-doc-path /path/to/TheProject-dobcmrverhdnmbaoppkndrntiijk/Build/Intermediates.noindex/TheProject.build/Debug/TheProject.build/Objects-normal/x86_64/main~partial.swiftdoc -serialize-diagnostics-path /path/to/TheProject-dobcmrverhdnmbaoppkndrntiijk/Build/Intermediates.noindex/TheProject.build/Debug/TheProject.build/Objects-normal/x86_64/main.dia -emit-dependencies-path /path/to/TheProject-dobcmrverhdnmbaoppkndrntiijk/Build/Intermediates.noindex/TheProject.build/Debug/TheProject.build/Objects-normal/x86_64/main.d -emit-reference-dependencies-path /path/to/TheProject-dobcmrverhdnmbaoppkndrntiijk/Build/Intermediates.noindex/TheProject.build/Debug/TheProject.build/Objects-normal/x86_64/main.swiftdeps -target x86_64-apple-macosx10.13 -enable-objc-interop -sdk /Applications/Xcode10Beta3.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk -I /path/to/TheProject-dobcmrverhdnmbaoppkndrntiijk/Build/Products/Debug -F /path/to/TheProject-dobcmrverhdnmbaoppkndrntiijk/Build/Products/Debug -enable-testing -g -module-cache-path /Users/nate/Library/Developer/Xcode/DerivedData/ModuleCache.noindex -swift-version 4.2 -enforce-exclusivity=checked -Onone -D DEBUG -serialize-debugging-options -Xcc -I/path/to/TheProject-dobcmrverhdnmbaoppkndrntiijk/Build/Intermediates.noindex/TheProject.build/Debug/TheProject.build/swift-overrides.hmap -Xcc -iquote -Xcc /path/to/TheProject-dobcmrverhdnmbaoppkndrntiijk/Build/Intermediates.noindex/TheProject.build/Debug/TheProject.build/TheProject-generated-files.hmap -Xcc -I/path/to/TheProject-dobcmrverhdnmbaoppkndrntiijk/Build/Intermediates.noindex/TheProject.build/Debug/TheProject.build/TheProject-own-target-headers.hmap -Xcc -I/path/to/TheProject-dobcmrverhdnmbaoppkndrntiijk/Build/Intermediates.noindex/TheProject.build/Debug/TheProject.build/TheProject-all-target-headers.hmap -Xcc -iquote -Xcc /path/to/TheProject-dobcmrverhdnmbaoppkndrntiijk/Build/Intermediates.noindex/TheProject.build/Debug/TheProject.build/TheProject-project-headers.hmap -Xcc -I/path/to/TheProject-dobcmrverhdnmbaoppkndrntiijk/Build/Products/Debug/include -Xcc -I/path/to/TheProject-dobcmrverhdnmbaoppkndrntiijk/Build/Intermediates.noindex/TheProject.build/Debug/TheProject.build/DerivedSources/x86_64 -Xcc -I/path/to/TheProject-dobcmrverhdnmbaoppkndrntiijk/Build/Intermediates.noindex/TheProject.build/Debug/TheProject.build/DerivedSources -Xcc -DDEBUG=1 -Xcc -working-directory/Users/nate/projects/Scratchpads/TheProject -module-name TheProject -o /path/to/TheProject-dobcmrverhdnmbaoppkndrntiijk/Build/Intermediates.noindex/TheProject.build/Debug/TheProject.build/Objects-normal/x86_64/main.o -index-store-path /path/to/TheProject-dobcmrverhdnmbaoppkndrntiijk/Index/DataStore -index-system-modules 
1.  While walking into decl 'Foo' at /path/to/main.swift:9:1
error: Abort trap: 6
@slavapestov
Copy link
Member

Looks like this was fixed a while ago. I'll add a regression test.

@swift-ci swift-ci transferred this issue from apple/swift-issues Apr 25, 2022
@AnthonyLatsis AnthonyLatsis added the crash Bug: A crash, i.e., an abnormal termination of software label Dec 12, 2022
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. compiler The Swift compiler in itself crash Bug: A crash, i.e., an abnormal termination of software
Projects
None yet
Development

No branches or pull requests

3 participants