-
Notifications
You must be signed in to change notification settings - Fork 10.5k
SIL verification failure when evaluating $0
in certain closures.
#66312
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
Comments
$0
passed into certain closures.$0
in certain closures.
The error seems to be originating in the SILVerifier, on this line specifically, where the SILVerifier calls the One of the things that the function does is ensure stack allocations and deallocations have a one to one mapping and it seems like the above generated SIL is not disciplined in that aspect. Details regarding what went wrong, where it went wrong and steps to reproduce are included below. |
Steps to determine the location of the compilation bug
|
CC: @nate-chandler |
The above command should generate a stack trace and the full SIL for the associated function, like in the MRP. Additionally, it should also generate the before and after versions of the SIL, around optimization pass number 13699 (as specified in the command above). The before and after versions of the SIL are pasted below. Before
After
|
The difference in the before and after versions is -
|
An However, optimization pass number 15 (transformation number ==> 13669.10) is swapping the
|
CC: @eeckstein |
…f_dynamic` with `alloc_ref` Fixes a verifier crash. swiftlang#66312
…f_dynamic` with `alloc_ref` Fixes a verifier crash. swiftlang#66312
Thanks for reporting! It's unbelievable that we didn't hit this bug earlier. It's in the compiler since 7 years. |
…f_dynamic` with `alloc_ref` Fixes a verifier crash. swiftlang#66312
Description
There is a SIL verification failure when attempting to build the following project in Release mode.
Much like this issue: #64642
it requires an internal Package to reproduce. If all the code is present in a single file, then the code will compile successfully.
The error message provided is:
SIL verification failed: stack dealloc with empty stack: !state.Stack.empty()
More details are shown below.
Steps to reproduce
This reproducer requires four files: two Package.swift files (one is for an internal package), and two regular Swift source files.
The directory tree looks like this:
Listing for
./Package.swift
:Listing for
./Sources/InternalPackage/Package.swift
:Listing for
./Sources/InternalPackage/Sources/InternalPackage/U.swift
:Listing for
./Sources/ReproducerServer/A.swift
:Expected behavior
The program should compile successfully.
Environment
Additional context
The full SIL-related error is as follows:
Stack trace:
Note that the above was built via Xcode.
If I attempt to perform a command-line build using
swift build -c release
with the 2023-05-30a toolchain, I get a different error message:Assertion failed: (CastInst::castIsValid(opc, C, Ty) && "Invalid constantexpr cast!"), function getCast, file Constants.cpp, line 1951.
when attempting to build files identical to, or in the same directory as:
Compiling NIOSSL ByteBufferBIO.swift
.This will be reported as a separate issue.
The text was updated successfully, but these errors were encountered: