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-9470] Compiler crasher, possibly related to tuples, implicit func type conversion and variadic parameters #51932

Closed
jepers opened this issue Dec 11, 2018 · 5 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

@jepers
Copy link

jepers commented Dec 11, 2018

Previous ID SR-9470
Radar None
Original Reporter @jepers
Type Bug
Status Closed
Resolution Done
Additional Detail from JIRA
Votes 0
Component/s Compiler
Labels Bug, CompilerCrash
Assignee None
Priority Medium

md5: 7676a8d56d752c49217e2065ee0d4b18

Issue Description:

The following program crashes the compiler, both the default toolchain of Xcode 10.1 and the most recent dev snapshot:

let _ = [(1, 2, 3)].map(max)
@theblixguy
Copy link
Collaborator

Seems to be crashing on line 5089 in CSApply.cpp:

assert(sources[i] != TupleShuffleExpr::DefaultInitialize && sources[i] != TupleShuffleExpr::Variadic);

So the tuple is being coerced from (Int, Int, Int) to (Int, Int, Int, Int...).

@slavapestov
Copy link
Member

Nice catch!

We're inferring that the element type of the array is (Int...), which is completely bogus, and crashing when we attempt to emit the call to build the array. The fix for this will basically be deleting some remnants from the old "argument list as tuple value" fever dream.

@theblixguy
Copy link
Collaborator

So is this a bug in the solver? Seems like up till `typeCheckExpression`, everything is fine & then it calls `cs.solve()` and it returns the wrong solution.

@slavapestov
Copy link
Member

Yes, you reabsolutely righr. I have a fix: #21360

@slavapestov
Copy link
Member

#21361

@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