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-11322] Reference to a stored property declared in an extension causes a segfault #53723

Closed
swift-ci opened this issue Aug 17, 2019 · 3 comments
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

Previous ID SR-11322
Radar rdar://problem/54471229
Original Reporter apaszke (JIRA User)
Type Bug
Status Resolved
Resolution Done
Environment

My swiftc -v is:

Apple Swift version 5.1 (swiftlang-1100.0.257.2 clang-1100.0.31.3)
Target: x86_64-apple-darwin18.6.0
Additional Detail from JIRA
Votes 0
Component/s Compiler
Labels Bug, CompilerCrash
Assignee None
Priority Medium

md5: 21305c1007034e348dd75956e8f31baf

Issue Description:

To reproduce put this in a.swift:

struct X {}

func f(x : X) { print(x.msg) } 

and this in b.swift:

extension X {
  let msg = "asdf"
}

Now, swiftc a.swift b.swift results in:

Stack dump:
0.      Program arguments: /Applications/Xcode-beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swift -frontend -c -primary-file a.swift b.swift -target x86_64-apple-darwin18.6.0 -enable-objc-interop -sdk /Applications/Xcode-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk -color-diagnostics -module-name main -o /var/folders/2m/4qk9gtvx79v14b7n1m_jj9hw00nbgb/T/a-6e7956.o
1.      While emitting IR SIL function "@$s4main1f1xyAA1XV_tF".
 for 'f(x:)' (at a.swift:4:1)
0  swift                    0x00000001051f20e3 PrintStackTraceSignalHandler(void*) + 51
1  swift                    0x00000001051f18b6 SignalHandler(int) + 358
2  libsystem_platform.dylib 0x00007fff65ceeb5d _sigtramp + 29
3  libsystem_platform.dylib 000000000000000000 _sigtramp + 2586907840
4  swift                    0x0000000101087d40 swift::SILInstructionVisitor<(anonymous namespace)::IRGenSILFunction, void>::visit(swift::SILInstruction*) + 10352                                          
5  swift                    0x000000010108295a swift::irgen::IRGenModule::emitSILFunction(swift::SILFunction*) + 9866                                                                                      
6  swift                    0x0000000100f2fb00 swift::irgen::IRGenerator::emitGlobalTopLevel() + 1712
7  swift                    0x000000010105f9ee performIRGeneration(swift::IRGenOptions&, swift::ModuleDecl*, std::__1::unique_ptr<swift::SILModule, std::__1::default_delete<swift::SILModule> >, llvm::Stri                                                   ngRef, swift::PrimarySpecificPaths const&, llvm::LLVMContext&, swift::SourceFile*, llvm::GlobalVariable**) + 1182                                                                                                                                            
8  swift                    0x0000000100e4c70a performCompile(swift::CompilerInstance&, swift::CompilerInvocation&, llvm::ArrayRef<char const*>, int&, swift::FrontendObserver*, swift::UnifiedStatsReporter                                                   *) + 36698
9  swift                    0x0000000100e3ffa4 swift::performFrontend(llvm::ArrayRef<char const*>, char const*, void*, swift::FrontendObserver*) + 6820                                                                                                      
10 swift                    0x0000000100dcdaf3 main + 1219
11 libdyld.dylib            0x00007fff65b033d5 start + 1
12 libdyld.dylib            0x0000000000000010 start + 2588920892
<unknown>:0: error: unable to execute command: Segmentation fault: 11
<unknown>:0: error: compile command failed due to signal 11 (use -v to see invocation)
@belkadan
Copy link
Contributor

Crashed in 5.0 as well. Huh.

@swift-ci create

@slavapestov
Copy link
Member

Looks like the checks are only done when emitting a declaration and not when referencing it. Should be easy to move it to StorageImplInfoRequest on master at least.

@slavapestov
Copy link
Member

#26688

@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