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-15720] Moving extension with custom decoding to separate file causes compiler to crash #57997

Open
swift-ci opened this issue Jan 11, 2022 · 0 comments
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. compiler The Swift compiler in itself

Comments

@swift-ci
Copy link
Collaborator

Previous ID SR-15720
Radar None
Original Reporter trey (JIRA User)
Type Bug

Attachment: Download

Environment

Xcode 13.2.1

Swift 5

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

md5: d43e58634755f7d39144b112edb8d1b1

Issue Description:

When the extensions are in the same file as the main declaration, the attached project builds successfully. When the extensions are moved to a separate file, the compiler crashes with:

Global is external, but doesn't have external or weak linkage!
%swift.type_descriptor* @"$s4test11EnvironmentV3MSLV10CodingKeys33_B088AB77345056538C29A4CD9A5C0748LLOMn"
Global is external, but doesn't have external or weak linkage!
%swift.type* @"$s4test11EnvironmentV3MSLV10CodingKeys33_B088AB77345056538C29A4CD9A5C0748LLON"
<unknown>:0: error: fatal error encountered during compilation; please submit a bug report (https://swift.org/contributing/#reporting-bugs) and include the project
<unknown>:0: note: Broken module found, compilation aborted!
Please submit a bug report (https://swift.org/contributing/#reporting-bugs) and include the project and the crash backtrace.
Stack dump:
0.  Program arguments: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swift-frontend -frontend -c "/Users/paucoin/Library/Autosave Information/test/Shared/ContentView.swift" -primary-file "/Users/paucoin/Library/Autosave Information/test/Environment.swift" "/Users/paucoin/Library/Autosave Information/test/Shared/testApp.swift" "/Users/paucoin/Library/Autosave Information/test/EnvironmentCoding.swift" -emit-dependencies-path "/Users/paucoin/Library/Developer/Xcode/DerivedData/test-eyspamhdemkxhkbvhwxcoitxrpxo/Build/Intermediates.noindex/test.build/Debug-iphonesimulator/test (iOS).build/Objects-normal/x86_64/Environment.d" -emit-reference-dependencies-path "/Users/paucoin/Library/Developer/Xcode/DerivedData/test-eyspamhdemkxhkbvhwxcoitxrpxo/Build/Intermediates.noindex/test.build/Debug-iphonesimulator/test (iOS).build/Objects-normal/x86_64/Environment.swiftdeps" -serialize-diagnostics-path "/Users/paucoin/Library/Developer/Xcode/DerivedData/test-eyspamhdemkxhkbvhwxcoitxrpxo/Build/Intermediates.noindex/test.build/Debug-iphonesimulator/test (iOS).build/Objects-normal/x86_64/Environment.dia" -target x86_64-apple-ios15.2-simulator -enable-objc-interop -sdk /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator15.2.sdk -I /Users/paucoin/Library/Developer/Xcode/DerivedData/test-eyspamhdemkxhkbvhwxcoitxrpxo/Build/Products/Debug-iphonesimulator -F /Users/paucoin/Library/Developer/Xcode/DerivedData/test-eyspamhdemkxhkbvhwxcoitxrpxo/Build/Products/Debug-iphonesimulator -no-color-diagnostics -enable-testing -g -module-cache-path /Users/paucoin/Library/Developer/Xcode/DerivedData/ModuleCache.noindex -emit-localized-strings -emit-localized-strings-path "/Users/paucoin/Library/Developer/Xcode/DerivedData/test-eyspamhdemkxhkbvhwxcoitxrpxo/Build/Intermediates.noindex/test.build/Debug-iphonesimulator/test (iOS).build/Objects-normal/x86_64" -swift-version 5 -enforce-exclusivity=checked -Onone -D DEBUG -serialize-debugging-options -Xcc -working-directory -Xcc "/Users/paucoin/Library/Autosave Information/test" -resource-dir /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift -enable-anonymous-context-mangled-names -Xcc "-I/Users/paucoin/Library/Developer/Xcode/DerivedData/test-eyspamhdemkxhkbvhwxcoitxrpxo/Build/Intermediates.noindex/test.build/Debug-iphonesimulator/test (iOS).build/swift-overrides.hmap" -Xcc -iquote -Xcc "/Users/paucoin/Library/Developer/Xcode/DerivedData/test-eyspamhdemkxhkbvhwxcoitxrpxo/Build/Intermediates.noindex/test.build/Debug-iphonesimulator/test (iOS).build/test-generated-files.hmap" -Xcc "-I/Users/paucoin/Library/Developer/Xcode/DerivedData/test-eyspamhdemkxhkbvhwxcoitxrpxo/Build/Intermediates.noindex/test.build/Debug-iphonesimulator/test (iOS).build/test-own-target-headers.hmap" -Xcc "-I/Users/paucoin/Library/Developer/Xcode/DerivedData/test-eyspamhdemkxhkbvhwxcoitxrpxo/Build/Intermediates.noindex/test.build/Debug-iphonesimulator/test (iOS).build/test-all-target-headers.hmap" -Xcc -iquote -Xcc "/Users/paucoin/Library/Developer/Xcode/DerivedData/test-eyspamhdemkxhkbvhwxcoitxrpxo/Build/Intermediates.noindex/test.build/Debug-iphonesimulator/test (iOS).build/test-project-headers.hmap" -Xcc -I/Users/paucoin/Library/Developer/Xcode/DerivedData/test-eyspamhdemkxhkbvhwxcoitxrpxo/Build/Products/Debug-iphonesimulator/include -Xcc "-I/Users/paucoin/Library/Developer/Xcode/DerivedData/test-eyspamhdemkxhkbvhwxcoitxrpxo/Build/Intermediates.noindex/test.build/Debug-iphonesimulator/test (iOS).build/DerivedSources-normal/x86_64" -Xcc "-I/Users/paucoin/Library/Developer/Xcode/DerivedData/test-eyspamhdemkxhkbvhwxcoitxrpxo/Build/Intermediates.noindex/test.build/Debug-iphonesimulator/test (iOS).build/DerivedSources/x86_64" -Xcc "-I/Users/paucoin/Library/Developer/Xcode/DerivedData/test-eyspamhdemkxhkbvhwxcoitxrpxo/Build/Intermediates.noindex/test.build/Debug-iphonesimulator/test (iOS).build/DerivedSources" -Xcc -DDEBUG=1 -module-name test -target-sdk-version 15.2.0 -o "/Users/paucoin/Library/Developer/Xcode/DerivedData/test-eyspamhdemkxhkbvhwxcoitxrpxo/Build/Intermediates.noindex/test.build/Debug-iphonesimulator/test (iOS).build/Objects-normal/x86_64/Environment.o" -index-store-path /Users/paucoin/Library/Developer/Xcode/DerivedData/test-eyspamhdemkxhkbvhwxcoitxrpxo/Index/DataStore -index-system-modules
1.  Apple Swift version 5.5.2 (swiftlang-1300.0.47.5 clang-1300.0.29.30)
2.  
Stack dump without symbol names (ensure you have llvm-symbolizer in your PATH or set the environment var `LLVM_SYMBOLIZER_PATH` to point to it):
0  swift-frontend           0x000000010a6cec27 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) + 39
1  swift-frontend           0x000000010a6cdbb8 llvm::sys::RunSignalHandlers() + 248
2  swift-frontend           0x000000010a6cf236 SignalHandler(int) + 278
3  libsystem_platform.dylib 0x00007fff203e8d7d _sigtramp + 29
4  libsystem_platform.dylib 0x00007ffeea500660 _sigtramp + 18446744072804727040
5  libsystem_c.dylib        0x00007fff202f8406 abort + 125
6  swift-frontend           0x00000001057e0502 swift::performFrontend(llvm::ArrayRef<char const*>, char const*, void*, swift::FrontendObserver*)::$_2::__invoke(void*, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, bool) + 978
7  swift-frontend           0x000000010a61869e llvm::report_fatal_error(llvm::Twine const&, bool) + 286
8  swift-frontend           0x000000010a61857b llvm::report_fatal_error(char const*, bool) + 43
9  swift-frontend           0x000000010a5af0de (anonymous namespace)::VerifierLegacyPass::doFinalization(llvm::Module&) + 174
10 swift-frontend           0x000000010a54fdd2 llvm::FPPassManager::doFinalization(llvm::Module&) + 66
11 swift-frontend           0x000000010a548570 llvm::legacy::FunctionPassManagerImpl::doFinalization(llvm::Module&) + 80
12 swift-frontend           0x0000000105cd5ba1 swift::performLLVMOptimizations(swift::IRGenOptions const&, llvm::Module*, llvm::TargetMachine*) + 1649
13 swift-frontend           0x0000000105cd69c7 swift::performLLVM(swift::IRGenOptions const&, swift::DiagnosticEngine&, llvm::sys::SmartMutex<false>*, llvm::GlobalVariable*, llvm::Module*, llvm::TargetMachine*, llvm::StringRef, swift::UnifiedStatsReporter*) + 2055
14 swift-frontend           0x00000001057eba9d performCompileStepsPostSILGen(swift::CompilerInstance&, std::__1::unique_ptr<swift::SILModule, std::__1::default_delete<swift::SILModule> >, llvm::PointerUnion<swift::ModuleDecl*, swift::SourceFile*>, swift::PrimarySpecificPaths const&, int&, swift::FrontendObserver*) + 3581
15 swift-frontend           0x00000001057dd346 swift::performFrontend(llvm::ArrayRef<char const*>, char const*, void*, swift::FrontendObserver*) + 13830
16 swift-frontend           0x000000010571db08 main + 1032
17 libdyld.dylib            0x00007fff203bef3d start + 1
18 libdyld.dylib            0x000000000000004e start + 18446603339975364882
Command SwiftDriverJob-Compile failed with a nonzero exit code
@swift-ci swift-ci transferred this issue from apple/swift-issues Apr 25, 2022
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
Projects
None yet
Development

No branches or pull requests

1 participant