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-12608] SPM Package SILGen Compiler Crash on Release #4561

Open
swift-ci opened this issue Apr 16, 2020 · 1 comment
Open

[SR-12608] SPM Package SILGen Compiler Crash on Release #4561

swift-ci opened this issue Apr 16, 2020 · 1 comment
Labels

Comments

@swift-ci
Copy link
Contributor

Previous ID SR-12608
Radar rdar://problem/62202397
Original Reporter Robuske (JIRA User)
Type Bug

Attachment: Download

Environment

macOS Catalina - 10.15.4
It crashes booth on command line and Xcode.
Xcode 11.4 (11E146)
Result of swift -v

Apple Swift version 5.2 (swiftlang-1103.0.32.1 clang-1103.0.32.29)
Target: x86_64-apple-darwin19.4.0
Additional Detail from JIRA
Votes 0
Component/s Compiler, Package Manager
Labels Bug, SILGen
Assignee None
Priority Medium

md5: 294d846eb0e21599042025547562c310

Issue Description:

The attached project crashes the compiler with Segmentation fault: 11, if built on RELEASE configuration (works as expected on DEBUG). Even the Xcode editor breaks (shows the yellow question mark).

The example contains a SwiftUI View that tries to use an extension defined in another target, if the extension contains a public ViewModifier it crashes, if it is private/internal, it does not. It also crashes if the extensions only returns self, or some other simple thing, like using .disabled.

There are some variations on what crashes or not commented in the project, originally I detected it in a much bigger iOS project, but was able to reduce to this macOS Package.

Stack dump:

0.  Program arguments: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swift -frontend -c /Users/robuske/Development/Personal/SomeName/Sources/SomeName/TestView.swift /Users/robuske/Development/Personal/SomeName/Sources/SomeName/ThisTargetView.swift -emit-module-path /Users/robuske/Library/Developer/Xcode/DerivedData/SomeName-euivcyagzrtswugxsdvhkjcdryzi/Build/Intermediates.noindex/SomeName.build/Release/SomeName.build/Objects-normal/x86_64/SomeName.swiftmodule -emit-module-doc-path /Users/robuske/Library/Developer/Xcode/DerivedData/SomeName-euivcyagzrtswugxsdvhkjcdryzi/Build/Intermediates.noindex/SomeName.build/Release/SomeName.build/Objects-normal/x86_64/SomeName.swiftdoc -emit-module-source-info-path /Users/robuske/Library/Developer/Xcode/DerivedData/SomeName-euivcyagzrtswugxsdvhkjcdryzi/Build/Intermediates.noindex/SomeName.build/Release/SomeName.build/Objects-normal/x86_64/SomeName.swiftsourceinfo -serialize-diagnostics-path /Users/robuske/Library/Developer/Xcode/DerivedData/SomeName-euivcyagzrtswugxsdvhkjcdryzi/Build/Intermediates.noindex/SomeName.build/Release/SomeName.build/Objects-normal/x86_64/SomeName-master.dia -emit-objc-header-path /Users/robuske/Library/Developer/Xcode/DerivedData/SomeName-euivcyagzrtswugxsdvhkjcdryzi/Build/Intermediates.noindex/SomeName.build/Release/SomeName.build/Objects-normal/x86_64/SomeName-Swift.h -emit-dependencies-path /Users/robuske/Library/Developer/Xcode/DerivedData/SomeName-euivcyagzrtswugxsdvhkjcdryzi/Build/Intermediates.noindex/SomeName.build/Release/SomeName.build/Objects-normal/x86_64/SomeName-master.d -target x86_64-apple-macos10.15 -enable-objc-interop -stack-check -sdk /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk -I /Users/robuske/Library/Developer/Xcode/DerivedData/SomeName-euivcyagzrtswugxsdvhkjcdryzi/Build/Products/Release -I /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/usr/lib -F /Users/robuske/Library/Developer/Xcode/DerivedData/SomeName-euivcyagzrtswugxsdvhkjcdryzi/Build/Products/Release -F /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/Library/Frameworks -g -module-cache-path /Users/robuske/Library/Developer/Xcode/DerivedData/ModuleCache.noindex -swift-version 5 -enforce-exclusivity=checked -O -D SWIFT_PACKAGE -D Xcode -serialize-debugging-options -Xcc -working-directory -Xcc /Users/robuske/Development/Personal/SomeName -Xcc -I/Users/robuske/Library/Developer/Xcode/DerivedData/SomeName-euivcyagzrtswugxsdvhkjcdryzi/Build/Intermediates.noindex/SomeName.build/Release/SomeName.build/swift-overrides.hmap -Xcc -I/Users/robuske/Library/Developer/Xcode/DerivedData/SomeName-euivcyagzrtswugxsdvhkjcdryzi/Build/Products/Release/include -Xcc -I/Users/robuske/Library/Developer/Xcode/DerivedData/SomeName-euivcyagzrtswugxsdvhkjcdryzi/Build/Intermediates.noindex/SomeName.build/Release/SomeName.build/DerivedSources-normal/x86_64 -Xcc -I/Users/robuske/Library/Developer/Xcode/DerivedData/SomeName-euivcyagzrtswugxsdvhkjcdryzi/Build/Intermediates.noindex/SomeName.build/Release/SomeName.build/DerivedSources/x86_64 -Xcc -I/Users/robuske/Library/Developer/Xcode/DerivedData/SomeName-euivcyagzrtswugxsdvhkjcdryzi/Build/Intermediates.noindex/SomeName.build/Release/SomeName.build/DerivedSources -Xcc -DSWIFT_PACKAGE -module-name SomeName -num-threads 4 -o /Users/robuske/Library/Developer/Xcode/DerivedData/SomeName-euivcyagzrtswugxsdvhkjcdryzi/Build/Intermediates.noindex/SomeName.build/Release/SomeName.build/Objects-normal/x86_64/TestView.o -o /Users/robuske/Library/Developer/Xcode/DerivedData/SomeName-euivcyagzrtswugxsdvhkjcdryzi/Build/Intermediates.noindex/SomeName.build/Release/SomeName.build/Objects-normal/x86_64/ThisTargetView.o 
1.  Apple Swift version 5.2 (swiftlang-1103.0.32.1 clang-1103.0.32.29)
2.  While emitting SIL for getter for body (at /Users/robuske/Development/Personal/SomeName/Sources/SomeName/TestView.swift:5:9)
3.  While silgen emitFunction SIL function "@$s8SomeName8TestViewV4bodyQrvg".
 for getter for body (at /Users/robuske/Development/Personal/SomeName/Sources/SomeName/TestView.swift:5:9)
0  swift                    0x000000010896d4ea PrintStackTraceSignalHandler(void*) + 42
1  swift                    0x000000010896ccc0 SignalHandler(int) + 352
2  libsystem_platform.dylib 0x00007fff7248c5fd _sigtramp + 29
3  libsystem_platform.dylib 000000000000000000 _sigtramp + 2377595424
4  swift                    0x0000000104ba71c8 (anonymous namespace)::Transform::transform(swift::Lowering::ManagedValue, swift::Lowering::AbstractionPattern, swift::CanType, swift::Lowering::AbstractionPattern, swift::CanType, swift::Lowering::SGFContext) + 12680
5  swift                    0x0000000104ba4028 swift::Lowering::SILGenFunction::emitOrigToSubstValue(swift::SILLocation, swift::Lowering::ManagedValue, swift::Lowering::AbstractionPattern, swift::CanType, swift::Lowering::SGFContext) + 136
6  swift                    0x0000000104b24886 swift::Lowering::Conversion::emit(swift::Lowering::SILGenFunction&, swift::SILLocation, swift::Lowering::ManagedValue, swift::Lowering::SGFContext) const + 710
7  swift                    0x0000000104ac682d (anonymous namespace)::ScalarResultPlan::finish(swift::Lowering::SILGenFunction&, swift::SILLocation, swift::CanType, llvm::ArrayRef<swift::Lowering::ManagedValue>&) + 1021
8  swift                    0x0000000104ae1c28 swift::Lowering::SILGenFunction::emitApply(std::__1::unique_ptr<swift::Lowering::ResultPlan, std::__1::default_delete<swift::Lowering::ResultPlan> >&&, swift::Lowering::ArgumentScope&&, swift::SILLocation, swift::Lowering::ManagedValue, swift::SubstitutionMap, llvm::ArrayRef<swift::Lowering::ManagedValue>, swift::Lowering::CalleeTypeInfo const&, swift::Lowering::ApplyOptions, swift::Lowering::SGFContext) + 1784
9  swift                    0x0000000104aef7bf (anonymous namespace)::CallEmission::apply(swift::Lowering::SGFContext) + 3951
10 swift                    0x0000000104aebc47 swift::Lowering::SILGenFunction::emitApplyExpr(swift::ApplyExpr*, swift::Lowering::SGFContext) + 2567
11 swift                    0x0000000104b43b9a swift::ASTVisitor<(anonymous namespace)::RValueEmitter, swift::Lowering::RValue, void, void, void, void, void, swift::Lowering::SGFContext>::visit(swift::Expr*, swift::Lowering::SGFContext) + 22410
12 swift                    0x0000000104b3e223 swift::Lowering::SILGenFunction::emitExprInto(swift::Expr*, swift::Lowering::Initialization*, llvm::Optional<swift::SILLocation>) + 131
13 swift                    0x0000000104bc2c1d swift::Lowering::SILGenFunction::emitReturnExpr(swift::SILLocation, swift::Expr*) + 845
14 swift                    0x0000000104bbe2fe swift::ASTVisitor<(anonymous namespace)::StmtEmitter, void, void, void, void, void, void>::visit(swift::Stmt*) + 12590
15 swift                    0x0000000104bbb316 swift::ASTVisitor<(anonymous namespace)::StmtEmitter, void, void, void, void, void, void>::visit(swift::Stmt*) + 326
16 swift                    0x0000000104b6dfdf swift::Lowering::SILGenFunction::emitFunction(swift::FuncDecl*) + 799
17 swift                    0x0000000104ad41b9 swift::Lowering::SILGenModule::emitFunction(swift::FuncDecl*) + 953
18 swift                    0x0000000104bcfa18 void llvm::function_ref<void (swift::AccessorDecl*)>::callback_fn<(anonymous namespace)::SILGenType::visitAccessors(swift::AbstractStorageDecl*)::'lambda'(swift::AccessorDecl*)>(long, swift::AccessorDecl*) + 24
19 swift                    0x0000000104bcf97c (anonymous namespace)::SILGenType::visitVarDecl(swift::VarDecl*) + 1948
20 swift                    0x0000000104bcc53b (anonymous namespace)::SILGenType::emitType() + 1163
21 swift                    0x0000000104ade5e2 swift::ASTVisitor<swift::Lowering::SILGenModule, void, void, void, void, void, void>::visit(swift::Decl*) + 82
22 swift                    0x0000000104add7ac swift::Lowering::SILGenModule::emitSourceFile(swift::SourceFile*) + 1356
23 swift                    0x0000000104adf88a swift::SILModule::constructSIL(swift::ModuleDecl*, swift::Lowering::TypeConverter&, swift::SILOptions&, swift::FileUnit*) + 1530
24 swift                    0x00000001046c13cb swift::performFrontend(llvm::ArrayRef<char const*>, char const*, void*, swift::FrontendObserver*) + 55595
25 swift                    0x00000001046374d3 main + 1283
26 libdyld.dylib            0x00007fff72293cc9 start + 1
@beccadax
Copy link
Contributor

@swift-ci create

@swift-ci swift-ci transferred this issue from apple/swift-issues Apr 25, 2022
@shahmishal shahmishal transferred this issue from apple/swift May 4, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants