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-4220] Compiler aborts with code involving IOUs and bridging casts #46803
Comments
Seems to fail in Debug builds as well. @swift-ci create |
It looks like it's only the argument that matters here. Leaving the return value to be implicitly unwrapped seems to work fine. This seems pretty strange since the error message is complaining about the NSDate, not the String, but that's what I'm observing. |
Comment by Dan Loewenherz (JIRA) I'm getting this crash too, but don't know how to isolate what code is causing it (25k LOC project). 🙁 @belkadan Any hints on how I might be able to track down the culprit? PHI node operands are not the same type as the result!
%397 = phi %CSo15NSDecimalNumber* [ %368, %365 ], [ %386, %388 ], !dbg !550
PHI node operands are not the same type as the result!
%754 = phi %CSo15NSDecimalNumber* [ %717, %714 ], [ %735, %737 ], !dbg !610
LLVM ERROR: Broken function found, compilation aborted! |
dloewenherz (JIRA User) the approach I took was to notice the `NSDate` mention in the errors and start slicing out bits that referenced `NSDate` with: fatalError("trimming")
#if false
... code referencing NSDate ...
#endif I got lucky since there weren't many mentions of NSDate in Swift files in the project I was in. You might be able to do the same thing with NSDecimalNumber in your project. |
Comment by Dan Loewenherz (JIRA) @tjw Thanks, that's a great suggestion. There are about 270 references to NSDecimalNumber in my project...but it seems like this compiler error only rears its head during instantiation. I'll comb through and do a binary search on those lines and see what I can find. |
Comment by Dan Loewenherz (JIRA) After two days of wrestling with this, no luck. 🙁 @belkadan is there any way to have the Swift compiler output which line number is the source of the problem? |
Comment by Dan Loewenherz (JIRA) Update: I was able to suppress this compiler error by updating the Swift Compiler Optimization Level in Xcode to "Fast, Single-File Optimization" (was "Fast, Whole Module Optimization"). Still have no idea what line is causing the problem. |
Comment by Bill Boland (JIRA) Just wanted to add a reference to the posts at fastlane fastlane/fastlane#8698 about this same compiler issue with Xcode 8.3 release. In my case, it was with the init of NSDecimalNumber. Using Single-File Optimization did not help me...probably because, in my project, an NSDecimalNumber was being created with and without an optional in the same file. I was able to recreate the issue with a new project and two files each having a class that created an NSDecimalNumber (one with a String and one with a String optional). Changed Debug to use WMO and got: PHI node operands are not the same type as the result!
%1423 = phi %CSo15NSDecimalNumber* [ %1438, %1433 ], [ %1411, %1413 ], !dbg !12471
PHI node operands are not the same type as the result!
%1438 = phi %CSo15NSDecimalNumber* [ %1384, %1381 ], [ %1411, %1412 ], !dbg !12471
LLVM ERROR: Broken function found, compilation aborted! Widget.swift class Widget {
func doSomething(_ configDict: [String: Any]) {
let otherCountStr = configDict["otherCount"] as? String
let otherCount = NSDecimalNumber(string: otherCountStr)
print(otherCount)
}
} Foo.swift class Foo {
func doSomething(_ configDict: [String: Any]) {
let otherCountStr = configDict["otherCount"] as? String ?? "1"
let otherCount = NSDecimalNumber(string: otherCountStr)
print(otherCount)
}
} |
Arnold fixed this already: |
Attachment: Download
Environment
macOS 10.12.3
Xcode 8.3 b4
Additional Detail from JIRA
md5: ad64252576e492069556fd4db8902049
is duplicated by:
Issue Description:
Open the attached project
Build the iOS Frameworks in Release mode
Crash; Xcode doesn't show the actual error
Copy the failing command and run it in Terminal
"output": "PHI node operands are not the same type as the result!\n %155 = phi %CSo6NSDate* [ %168, %163 ], [ %143, %145 ], 87\nPHI node operands are not the same type as the result!\n %168 = phi %CSo6NSDate* [ %114, %110 ], [ %143, %144 ], 87\nLLVM ERROR: Broken function found, compilation aborted!\n",
Open Test.swift
Uncomment the version that explicitly unwraps the IUOs
Build; succeeds.
The text was updated successfully, but these errors were encountered: