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-7549] Global is external, but doesn't have external or weak linkage! crash #50091

Closed
keith opened this issue Apr 26, 2018 · 5 comments
Closed
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

@keith
Copy link
Collaborator

keith commented Apr 26, 2018

Previous ID SR-7549
Radar rdar://problem/39763787
Original Reporter @keith
Type Bug
Status Closed
Resolution Done

Attachment: Download

Environment

swift-4.2-DEVELOPMENT-SNAPSHOT-2018-04-23-a
Xcode 9.3

Additional Detail from JIRA
Votes 0
Component/s Compiler
Labels Bug, CompilerCrash
Assignee None
Priority Medium

md5: f55ebb32e2ff3e3ebb0421f018198df7

Issue Description:

Attached is a sample project that produces this compiler crash:

Global is external, but doesn't have external or weak linkage!
%swift.metadata_response (i64)* @"$S6Second8Property33_241EE7586AF57F5A142D57A4DBC25F8ALLOMa"
<unknown>:0: error: fatal error encountered during compilation; please file a bug report with your project and the crash log
<unknown>:0: note: Broken module found, compilation aborted!
0  swift                    0x000000010eb7d938 llvm::sys::PrintStackTrace(llvm::raw_ostream&) + 40
1  swift                    0x000000010eb7e046 SignalHandler(int) + 694
2  libsystem_platform.dylib 0x00007fff5c6f8f5a _sigtramp + 26
3  libsystem_platform.dylib 0x00007ffee4863568 _sigtramp + 2283185704
4  libsystem_c.dylib        0x00007fff5c4961ae abort + 127
5  swift                    0x000000010b3e4d97 swift::performFrontend(llvm::ArrayRef<char const*>, char const*, void*, swift::FrontendObserver*)::$_0::__invoke(void*, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, bool) + 519
6  swift                    0x000000010eb1cfdc llvm::report_fatal_error(llvm::Twine const&, bool) + 252
7  swift                    0x000000010eb1cedb llvm::report_fatal_error(char const*, bool) + 43
8  swift                    0x000000010eacded2 (anonymous namespace)::VerifierLegacyPass::doFinalization(llvm::Module&) + 210
9  swift                    0x000000010ea5f930 llvm::FPPassManager::doFinalization(llvm::Module&) + 80
10 swift                    0x000000010ea5f10b llvm::legacy::FunctionPassManagerImpl::doFinalization(llvm::Module&) + 107
11 swift                    0x000000010b543998 swift::performLLVMOptimizations(swift::IRGenOptions&, llvm::Module*, llvm::TargetMachine*) + 1496
12 swift                    0x000000010b5444be swift::performLLVM(swift::IRGenOptions&, swift::DiagnosticEngine*, llvm::sys::SmartMutex<false>*, llvm::GlobalVariable*, llvm::Module*, llvm::TargetMachine*, swift::version::Version const&, llvm::StringRef, swift::UnifiedStatsReporter*) + 2062
13 swift                    0x000000010b3e4735 performCompile(swift::CompilerInstance&, swift::CompilerInvocation&, llvm::ArrayRef<char const*>, int&, swift::FrontendObserver*, swift::UnifiedStatsReporter*) + 16229
14 swift                    0x000000010b3df7be swift::performFrontend(llvm::ArrayRef<char const*>, char const*, void*, swift::FrontendObserver*) + 3310
15 swift                    0x000000010b39c0dd main + 2317
16 libdyld.dylib            0x00007fff5c3ea015 start + 1
17 libdyld.dylib            0x0000000000000043 start + 2747359279
Stack dump:
0.  Program arguments: /Library/Developer/Toolchains/swift-4.2-DEVELOPMENT-SNAPSHOT-2018-04-23-a.xctoolchain/usr/bin/swift -frontend -c -primary-file /Users/ksmiley/Downloads/TestCompilerCrash/First/First.swift -emit-module-path /Users/ksmiley/Downloads/TestCompilerCrash/build.noindex/TestCompilerCrash/Build/Intermediates.noindex/TestCompilerCrash.build/Debug-iphonesimulator/First.build/Objects-normal/x86_64/First~partial.swiftmodule -emit-module-doc-path /Users/ksmiley/Downloads/TestCompilerCrash/build.noindex/TestCompilerCrash/Build/Intermediates.noindex/TestCompilerCrash.build/Debug-iphonesimulator/First.build/Objects-normal/x86_64/First~partial.swiftdoc -serialize-diagnostics-path /Users/ksmiley/Downloads/TestCompilerCrash/build.noindex/TestCompilerCrash/Build/Intermediates.noindex/TestCompilerCrash.build/Debug-iphonesimulator/First.build/Objects-normal/x86_64/First.dia -emit-dependencies-path /Users/ksmiley/Downloads/TestCompilerCrash/build.noindex/TestCompilerCrash/Build/Intermediates.noindex/TestCompilerCrash.build/Debug-iphonesimulator/First.build/Objects-normal/x86_64/First.d -emit-reference-dependencies-path /Users/ksmiley/Downloads/TestCompilerCrash/build.noindex/TestCompilerCrash/Build/Intermediates.noindex/TestCompilerCrash.build/Debug-iphonesimulator/First.build/Objects-normal/x86_64/First.swiftdeps -target x86_64-apple-ios11.3 -enable-objc-interop -sdk /Applications/Xcode-9.3.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator11.3.sdk -I /Users/ksmiley/Downloads/TestCompilerCrash/build.noindex/TestCompilerCrash/Build/Products/Debug-iphonesimulator -F /Users/ksmiley/Downloads/TestCompilerCrash/build.noindex/TestCompilerCrash/Build/Products/Debug-iphonesimulator -enable-testing -g -module-cache-path /Users/ksmiley/Downloads/TestCompilerCrash/build.noindex/ModuleCache.noindex -swift-version 4 -enforce-exclusivity=checked -Onone -D DEBUG -serialize-debugging-options -Xcc -I/Users/ksmiley/Downloads/TestCompilerCrash/build.noindex/TestCompilerCrash/Build/Intermediates.noindex/TestCompilerCrash.build/Debug-iphonesimulator/First.build/swift-overrides.hmap -Xcc -iquote -Xcc /Users/ksmiley/Downloads/TestCompilerCrash/build.noindex/TestCompilerCrash/Build/Intermediates.noindex/TestCompilerCrash.build/Debug-iphonesimulator/First.build/First-generated-files.hmap -Xcc -I/Users/ksmiley/Downloads/TestCompilerCrash/build.noindex/TestCompilerCrash/Build/Intermediates.noindex/TestCompilerCrash.build/Debug-iphonesimulator/First.build/First-own-target-headers.hmap -Xcc -I/Users/ksmiley/Downloads/TestCompilerCrash/build.noindex/TestCompilerCrash/Build/Intermediates.noindex/TestCompilerCrash.build/Debug-iphonesimulator/First.build/First-all-target-headers.hmap -Xcc -iquote -Xcc /Users/ksmiley/Downloads/TestCompilerCrash/build.noindex/TestCompilerCrash/Build/Intermediates.noindex/TestCompilerCrash.build/Debug-iphonesimulator/First.build/First-project-headers.hmap -Xcc -I/Users/ksmiley/Downloads/TestCompilerCrash/build.noindex/TestCompilerCrash/Build/Products/Debug-iphonesimulator/include -Xcc -I/Users/ksmiley/Downloads/TestCompilerCrash/build.noindex/TestCompilerCrash/Build/Intermediates.noindex/TestCompilerCrash.build/Debug-iphonesimulator/First.build/DerivedSources/x86_64 -Xcc -I/Users/ksmiley/Downloads/TestCompilerCrash/build.noindex/TestCompilerCrash/Build/Intermediates.noindex/TestCompilerCrash.build/Debug-iphonesimulator/First.build/DerivedSources -Xcc -DDEBUG=1 -Xcc -working-directory/Users/ksmiley/Downloads/TestCompilerCrash -parse-as-library -module-name First -o /Users/ksmiley/Downloads/TestCompilerCrash/build.noindex/TestCompilerCrash/Build/Intermediates.noindex/TestCompilerCrash.build/Debug-iphonesimulator/First.build/Objects-normal/x86_64/First.o -index-store-path /Users/ksmiley/Downloads/TestCompilerCrash/build.noindex/TestCompilerCrash/Index/DataStore -index-system-modules
@keith
Copy link
Collaborator Author

keith commented Apr 26, 2018

Making `Property` public works around this issue.

@belkadan
Copy link
Contributor

belkadan commented May 1, 2018

@swift-ci create

@DougGregor
Copy link
Member

I introduced a short-term hack (via a new command line argument -emit-public-type-metadata-accessors) in #16616 and @rjmccall has a much-better-but-much-more-invasive fix in #16615.

@lilyball
Copy link
Mannequin

lilyball mannequin commented Jun 20, 2018

For anyone else still hitting this in Xcode 10 beta 2, I guess the PR still isn't part of that release, despite being merged over a month ago. I'm still hitting this issue in PMJSON in Xcode 10 beta 2, but using the latest Swift 4.2 Snapshot toolchain works just fine. I hope this means Xcode 10 beta 3 will include the fix (though I don't understand why Xcode 10 beta 2 didn't).

@keith
Copy link
Collaborator Author

keith commented Jul 10, 2018

This repro case is fixed in Xcode 10 beta 3

@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

4 participants