-
Notifications
You must be signed in to change notification settings - Fork 10.6k
Open
Labels
SIL ownershipArea → compiler → SIL: SIL ownershipArea → compiler → SIL: SIL ownershipassertion failureBug → crash: An assertion failureBug → crash: An assertion failurebugA deviation from expected or documented behavior. Also: expected but undesirable behavior.A deviation from expected or documented behavior. Also: expected but undesirable behavior.crashBug: A crash, i.e., an abnormal termination of softwareBug: A crash, i.e., an abnormal termination of software
Description
Describe the bug
compiling the following test program crashes the compiler (and also sourcekit-lsp). the crash is new, i could not reproduce it on the 5.6.2 release toolchain, or the DEVELOPMENT-SNAPSHOT-2022-08-01-a nightly.
Steps To Reproduce
- save the following to
test.swift:
struct C<T> where T:AdditiveArithmetic
{
var x:[Int]
let y:T
init()
{
self.x = [0]
self.y = .zero
}
var z:Int
{
_read
{
yield self.x[0]
}
_modify
{
yield &self.x[0]
}
}
}
struct S
{
var c:C<Int>
init()
{
self.c = .init()
let _:Int = self.c.z
}
}- run
swiftc test.swiftwith a recent nightly:
$ swiftc test2.swift
error: compile command failed due to signal 6 (use -v to see invocation)
Begin Error in Function: '$s5test21SVACycfC'
Found outside of lifetime use?!
Value: %17 = load_borrow %16 : $*C<Int> // users: %27, %19
Consuming User: end_borrow %17 : $C<Int> // id: %27
Non Consuming User: end_borrow %19 : $*C<Int> // id: %30
Block: bb0
End Error in Function: '$s5test21SVACycfC'
Found ownership error?!
triggering standard assertion failure routine
UNREACHABLE executed at /home/build-user/swift/lib/SIL/Verifier/LinearLifetimeCheckerPrivate.h:211!
Please submit a bug report (https://swift.org/contributing/#reporting-bugs) and include the project and the crash backtrace.
Stack dump:
0. Program arguments: /home/ec2-user/.swiftenv/versions/DEVELOPMENT-SNAPSHOT-2022-09-06-a/usr/bin/swift-frontend -frontend -c -primary-file test2.swift -target x86_64-unknown-linux-gnu -disable-objc-interop -color-diagnostics -new-driver-path /home/ec2-user/.swiftenv/versions/DEVELOPMENT-SNAPSHOT-2022-09-06-a/usr/bin/swift-driver -empty-abi-descriptor -resource-dir /home/ec2-user/.swiftenv/versions/DEVELOPMENT-SNAPSHOT-2022-09-06-a/usr/lib/swift -module-name test2 -o /tmp/TemporaryDirectory.urmXsl/test2-1.o
1. Swift version 5.8-dev (LLVM a049441a0549936, Swift a973fe5375d3851)
2. Compiling with the current language version
3. While evaluating request ASTLoweringRequest(Lowering AST to SIL for file "test2.swift")
4. While silgen emitConstructor SIL function "@$s5test21SVACycfC".
for 'init()' (at test2.swift:28:5)
5. While verifying SIL function "@$s5test21SVACycfC".
for 'init()' (at test2.swift:28:5)
Stack dump without symbol names (ensure you have llvm-symbolizer in your PATH or set the environment var `LLVM_SYMBOLIZER_PATH` to point to it):
/home/ec2-user/.swiftenv/versions/DEVELOPMENT-SNAPSHOT-2022-09-06-a/usr/bin/swift-frontend[0x67cbe23]
/home/ec2-user/.swiftenv/versions/DEVELOPMENT-SNAPSHOT-2022-09-06-a/usr/bin/swift-frontend[0x67c9afe]
/home/ec2-user/.swiftenv/versions/DEVELOPMENT-SNAPSHOT-2022-09-06-a/usr/bin/swift-frontend[0x67cc1af]
/lib64/libpthread.so.0(+0x118e0)[0x7f7c76eca8e0]
/lib64/libc.so.6(gsignal+0x110)[0x7f7c751edca0]
/lib64/libc.so.6(abort+0x148)[0x7f7c751ef148]
/home/ec2-user/.swiftenv/versions/DEVELOPMENT-SNAPSHOT-2022-09-06-a/usr/bin/swift-frontend[0x66fa711]
/home/ec2-user/.swiftenv/versions/DEVELOPMENT-SNAPSHOT-2022-09-06-a/usr/bin/swift-frontend[0x87dcee]
/home/ec2-user/.swiftenv/versions/DEVELOPMENT-SNAPSHOT-2022-09-06-a/usr/bin/swift-frontend[0x8e5b0d]
/home/ec2-user/.swiftenv/versions/DEVELOPMENT-SNAPSHOT-2022-09-06-a/usr/bin/swift-frontend[0x8e72c7]
/home/ec2-user/.swiftenv/versions/DEVELOPMENT-SNAPSHOT-2022-09-06-a/usr/bin/swift-frontend[0x87b4f4]
/home/ec2-user/.swiftenv/versions/DEVELOPMENT-SNAPSHOT-2022-09-06-a/usr/bin/swift-frontend[0x87d622]
/home/ec2-user/.swiftenv/versions/DEVELOPMENT-SNAPSHOT-2022-09-06-a/usr/bin/swift-frontend[0x87d4bc]
/home/ec2-user/.swiftenv/versions/DEVELOPMENT-SNAPSHOT-2022-09-06-a/usr/bin/swift-frontend[0x8a2e8d]
/home/ec2-user/.swiftenv/versions/DEVELOPMENT-SNAPSHOT-2022-09-06-a/usr/bin/swift-frontend[0x8a588f]
/home/ec2-user/.swiftenv/versions/DEVELOPMENT-SNAPSHOT-2022-09-06-a/usr/bin/swift-frontend[0x895826]
/home/ec2-user/.swiftenv/versions/DEVELOPMENT-SNAPSHOT-2022-09-06-a/usr/bin/swift-frontend[0x888b75]
/home/ec2-user/.swiftenv/versions/DEVELOPMENT-SNAPSHOT-2022-09-06-a/usr/bin/swift-frontend[0x886e9e]
/home/ec2-user/.swiftenv/versions/DEVELOPMENT-SNAPSHOT-2022-09-06-a/usr/bin/swift-frontend[0x87f2fb]
/home/ec2-user/.swiftenv/versions/DEVELOPMENT-SNAPSHOT-2022-09-06-a/usr/bin/swift-frontend[0xd578ee]
/home/ec2-user/.swiftenv/versions/DEVELOPMENT-SNAPSHOT-2022-09-06-a/usr/bin/swift-frontend[0xd56883]
/home/ec2-user/.swiftenv/versions/DEVELOPMENT-SNAPSHOT-2022-09-06-a/usr/bin/swift-frontend[0xd58cd4]
/home/ec2-user/.swiftenv/versions/DEVELOPMENT-SNAPSHOT-2022-09-06-a/usr/bin/swift-frontend[0xd5903a]
/home/ec2-user/.swiftenv/versions/DEVELOPMENT-SNAPSHOT-2022-09-06-a/usr/bin/swift-frontend[0xe1db1e]
/home/ec2-user/.swiftenv/versions/DEVELOPMENT-SNAPSHOT-2022-09-06-a/usr/bin/swift-frontend[0xe1d818]
/home/ec2-user/.swiftenv/versions/DEVELOPMENT-SNAPSHOT-2022-09-06-a/usr/bin/swift-frontend[0xd5b835]
/home/ec2-user/.swiftenv/versions/DEVELOPMENT-SNAPSHOT-2022-09-06-a/usr/bin/swift-frontend[0xe0f1ff]
/home/ec2-user/.swiftenv/versions/DEVELOPMENT-SNAPSHOT-2022-09-06-a/usr/bin/swift-frontend[0xd5ff2a]
/home/ec2-user/.swiftenv/versions/DEVELOPMENT-SNAPSHOT-2022-09-06-a/usr/bin/swift-frontend[0xd5d025]
/home/ec2-user/.swiftenv/versions/DEVELOPMENT-SNAPSHOT-2022-09-06-a/usr/bin/swift-frontend[0x68c4bd]
/home/ec2-user/.swiftenv/versions/DEVELOPMENT-SNAPSHOT-2022-09-06-a/usr/bin/swift-frontend[0x68ef56]
/home/ec2-user/.swiftenv/versions/DEVELOPMENT-SNAPSHOT-2022-09-06-a/usr/bin/swift-frontend[0x4c1f4c]
/lib64/libc.so.6(__libc_start_main+0xea)[0x7f7c751db13a]
/home/ec2-user/.swiftenv/versions/DEVELOPMENT-SNAPSHOT-2022-09-06-a/usr/bin/swift-frontend[0x4c111a]Expected behavior
the compiler should not crash.
Environment (please fill out the following information)
- OS: amazon linux 2
- swift:
DEVELOPMENT-SNAPSHOT-2022-08-24-a
Metadata
Metadata
Assignees
Labels
SIL ownershipArea → compiler → SIL: SIL ownershipArea → compiler → SIL: SIL ownershipassertion failureBug → crash: An assertion failureBug → crash: An assertion failurebugA deviation from expected or documented behavior. Also: expected but undesirable behavior.A deviation from expected or documented behavior. Also: expected but undesirable behavior.crashBug: A crash, i.e., an abnormal termination of softwareBug: A crash, i.e., an abnormal termination of software