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-10923] buildIf causing segmentation fault #53314

Closed
swift-ci opened this issue Jun 12, 2019 · 2 comments
Closed

[SR-10923] buildIf causing segmentation fault #53314

swift-ci opened this issue Jun 12, 2019 · 2 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 result builders Feature: Result builders

Comments

@swift-ci
Copy link
Collaborator

Previous ID SR-10923
Radar rdar://problem/51690632
Original Reporter djtech42 (JIRA User)
Type Bug
Status Resolved
Resolution Done
Environment

Xcode 11 Beta [1, 2, 3, 4] (Default Included Swift 5.1 Toolchain)

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

md5: e5cc72ce043e01a3580e20ec54be9005

Issue Description:

Adding an if statement to a function using this functionBuilder, the compiler crashes. (segmentation fault 11)

@_functionBuilder
public struct StringBuilder {
    public static func buildBlock(_ children: String...) -> String {
        return children.joined()
    }

    public static func buildIf(_ child: String?) -> String {
        return child ?? ""
    }
}

@StringBuilder
public func combinedString(spaced: Bool) -> String {
    "test"
    if spaced {
        " "
    }
    "other"
}
1.  While emitting SIL for 'combinedString(spaced:)' (at /Users/dan/Desktop/StringPattern/Sources/StringPattern/StringBuilder.swift:22:8)
0  swift                    0x00000001046e78a3 PrintStackTraceSignalHandler(void*) + 51
1  swift                    0x00000001046e7076 SignalHandler(int) + 358
2  libsystem_platform.dylib 0x00007fff68724b1d _sigtramp + 29
3  libsystem_platform.dylib 0x00007ffeef93c0c8 _sigtramp + 2267117000
4  swift                    0x0000000100c92187 swift::SILProfiler::create(swift::SILModule&, swift::ForDefinition_t, swift::ASTNode) + 3079
5  swift                    0x00000001007403f3 setUpForProfiling(swift::SILDeclRef, swift::SILFunction*, swift::ForDefinition_t) + 115
6  swift                    0x000000010073f503 swift::Lowering::SILGenModule::getFunction(swift::SILDeclRef, swift::ForDefinition_t) + 483
7  swift                    0x0000000100740b16 swift::Lowering::SILGenModule::emitFunction(swift::FuncDecl*) + 790
8  swift                    0x000000010074b456 swift::Lowering::SILGenModule::emitSourceFile(swift::SourceFile*) + 1238
9  swift                    0x000000010074cedc swift::SILModule::constructSIL(swift::ModuleDecl*, swift::SILOptions&, swift::FileUnit*) + 1244
10 swift                    0x0000000100359d75 performCompile(swift::CompilerInstance&, swift::CompilerInvocation&, llvm::ArrayRef<char const*>, int&, swift::FrontendObserver*, swift::UnifiedStatsReporter*) + 28757
11 swift                    0x000000010034f424 swift::performFrontend(llvm::ArrayRef<char const*>, char const*, void*, swift::FrontendObserver*) + 6868
12 swift                    0x00000001002de6b3 main + 1219
13 libdyld.dylib            0x00007fff685247a9 start + 1
14 libdyld.dylib            0x0000000000000052 start + 2544744618
error: Segmentation fault: 11
@swift-ci
Copy link
Collaborator Author

Comment by Dan Turner (JIRA)

still happening in Xcode 11 beta 4

@swift-ci
Copy link
Collaborator Author

Comment by Dan Turner (JIRA)

fixed in Xcode 11 beta 5

@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 result builders Feature: Result builders
Projects
None yet
Development

No branches or pull requests

2 participants