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-7694] Swift 4.1 compiler crashes with error 'Bus error: 10' #50234

Open
swift-ci opened this issue May 15, 2018 · 4 comments
Open

[SR-7694] Swift 4.1 compiler crashes with error 'Bus error: 10' #50234

swift-ci opened this issue May 15, 2018 · 4 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-7694
Radar None
Original Reporter Koninis (JIRA User)
Type Bug
Environment

Xcode Version 9.3 (9E145), Apple Swift version 4.1 (swiftlang-902.0.48 clang-902.0.37.1)

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

md5: 3793dc8fd1f555d9e97fe38a752d73e4

Issue Description:

Compiler crashes when compiling the following code:

struct StructA {
   var variableA: Int?
   var variableB: ((StructA) -> Void)?
   var id: String?

   init(variableA:Int? = nil,
        variableB: ((_ structA: StructA) -> Void)? = nil) {
      self.variableA = variableA
      self.variableB = variableB
   }

   func copyStruct() -> StructA {
      return StructA(variableB: self.variableB)
   }
}

with the following error:

swiftc StructA.swift 
0 swift 0x00000001108abffa PrintStackTraceSignalHandler(void*) + 42
1 swift 0x00000001108ab3b6 SignalHandler(int) + 966
2 libsystem_platform.dylib 0x00007fff644acf5a _sigtramp + 26
3 libsystem_platform.dylib 0x0000000000000001 _sigtramp + 2612342977
4 swift 0x000000010cf5824d llvm::IRBuilder<llvm::ConstantFolder, llvm::IRBuilderDefaultInserter>::CreateCast(llvm::Instruction::CastOps, llvm::Value*, llvm::Type*, llvm::Twine const&) + 77
5 swift 0x000000010d069cca swift::irgen::reemitAsUnsubstituted(swift::irgen::IRGenFunction&, swift::SILType, swift::SILType, swift::irgen::Explosion&, swift::irgen::Explosion&) + 522
6 swift 0x000000010d0f1da9 emitApplyArgument((anonymous namespace)::IRGenSILFunction&, swift::SILValue, swift::SILType, swift::irgen::Explosion&) + 393
7 swift 0x000000010d0f1119 (anonymous namespace)::IRGenSILFunction::visitFullApplySite(swift::FullApplySite) + 2569
8 swift 0x000000010d0ceff1 swift::irgen::IRGenModule::emitSILFunction(swift::SILFunction*) + 9073
9 swift 0x000000010cfc4070 swift::irgen::IRGenerator::emitGlobalTopLevel() + 1024
10 swift 0x000000010d0b0527 performIRGeneration(swift::IRGenOptions&, swift::ModuleDecl*, std::__1::unique_ptr<swift::SILModule, std::__1::default_delete<swift::SILModule> >, llvm::StringRef, llvm::LLVMContext&, swift::SourceFile*, llvm::GlobalVariable**, unsigned int) + 1399
11 swift 0x000000010cf0bdce performCompile(swift::CompilerInstance&, swift::CompilerInvocation&, llvm::ArrayRef<char const*>, int&, swift::FrontendObserver*, swift::UnifiedStatsReporter*) + 38110
12 swift 0x000000010cf00e64 swift::performFrontend(llvm::ArrayRef<char const*>, char const*, void*, swift::FrontendObserver*) + 7908
13 swift 0x000000010ceb58b5 main + 18917
14 libdyld.dylib 0x00007fff6419e015 start + 1
Stack dump:
0. Program arguments: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swift -frontend -c -primary-file StructA.swift -target x86_64-apple-darwin17.5.0 -enable-objc-interop -sdk /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk -color-diagnostics -module-name StructA -o /var/folders/kg/dpjfy4nj7h15c4ymhcfth1br0000gn/T/StructA-139c97.o 
1. While emitting IR SIL function "@_T07StructAAAV04copyA0AByF".
 for 'copyStruct()' at StructA.swift:23:5
<unknown>:0: error: unable to execute command: Bus error: 10
<unknown>:0: error: compile command failed due to signal 10 (use -v to see invocation)
@belkadan
Copy link
Contributor

Seems to be fixed on master, but not sure about the 4.2 branch.

@swift-ci
Copy link
Collaborator Author

swift-ci commented Feb 1, 2019

Comment by Mohamed Tahar Mosbah (JIRA)

I'm having a similar error message using Apple Swift version 5.0 swiftlang-1001.0.45.7 clang-1001.0.37.7 shipped with Xcode 10.2 beta, not sure if it's related.

logs here

@belkadan
Copy link
Contributor

belkadan commented Feb 1, 2019

I'd assume it's not related. Can you file a separate bug and attach the breaking version of the project?

@swift-ci
Copy link
Collaborator Author

swift-ci commented Feb 4, 2019

Comment by Mohamed Tahar Mosbah (JIRA)

thanks @belkadan, SR-9858 created

@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
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