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-3301] Segmentation fault with -O and -whole-module-optimization #45889

Closed
swift-ci opened this issue Dec 1, 2016 · 6 comments
Closed

[SR-3301] Segmentation fault with -O and -whole-module-optimization #45889

swift-ci opened this issue Dec 1, 2016 · 6 comments
Assignees
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 optimized only Flag: An issue whose reproduction requires optimized compilation run-time crash Bug → crash: Swift code crashed during execution

Comments

@swift-ci
Copy link
Collaborator

swift-ci commented Dec 1, 2016

Previous ID SR-3301
Radar rdar://problem/29788633
Original Reporter kfitzgerald (JIRA User)
Type Bug
Status Resolved
Resolution Done
Environment

Apple Swift version 3.0.1 (swiftlang-800.0.58.6 clang-800.0.42.1)
Target: x86_64-apple-macosx10.9

Additional Detail from JIRA
Votes 0
Component/s Compiler
Labels Bug, OptimizedOnly, RunTimeCrash
Assignee @eeckstein
Priority Medium

md5: 4c971764d757edf9601987d6b540e0f6

Issue Description:

Running the code below causes a segmentation fault when compiled with the following flags

swiftc -O -whole-module-optimization main.swift log.swift
./main 
Segmentation fault: 11

Compiling the code without either optimization produces the correct output

swiftc -O main.swift log.swift 
./main 
called log
ABC
func log(_: String) {
  print("called log")
}
let values = ["A","B","C"]
let str = values.reduce("", {$0 + $1})

log("\(str)")
print(str)

I can get this to segfault on both 3.0.1 and the nightly snapshot

@belkadan
Copy link
Contributor

belkadan commented Dec 9, 2016

Seems to be fixed on master.

@belkadan
Copy link
Contributor

belkadan commented Dec 9, 2016

Ooh, no it isn't. The order of the files matters for some reason.

@belkadan
Copy link
Contributor

belkadan commented Dec 9, 2016

@bob-wilson, who should look at this?

@bob-wilson
Copy link

@eeckstein Can you investigate?

@eeckstein
Copy link
Member

It's a bug in SILCombine, leading to an ARC-related use-after-free problem.
Working on a fix right now.

@eeckstein
Copy link
Member

fixed in 4282f35

@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 optimized only Flag: An issue whose reproduction requires optimized compilation run-time crash Bug → crash: Swift code crashed during execution
Projects
None yet
Development

No branches or pull requests

5 participants