-
Notifications
You must be signed in to change notification settings - Fork 10.5k
crash: Non trivial values, non address values, and non guaranteed function args must have at least one lifetime ending use?! #74595
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
Labels
bug
A deviation from expected or documented behavior. Also: expected but undesirable behavior.
compiler
The Swift compiler itself
crash
Bug: A crash, i.e., an abnormal termination of software
move-only
Feature → type declarations: Move-only type declarations
ownership
Feature: Ownership modifiers and semantics
SIL
SILOptimizer
Area → compiler: SIL optimization passes
Comments
@tayloraswift Detailssil_stage canonical
import Builtin
import Swift
import SwiftShims
actor A {
@_hasStorage nonisolated final let x: Int { get }
init()
@objc deinit
@available(iOS 13.0, tvOS 13.0, watchOS 6.0, macOS 10.15, *)
@_semantics("defaultActor") nonisolated final var unownedExecutor: UnownedSerialExecutor {
get
}
}
struct AWrapper : ~Copyable {
@_hasStorage let a: A { get }
var x: Int { get }
init(a: A)
}
// main
// Isolation: unspecified
sil @main : $@convention(c) (Int32, UnsafeMutablePointer<Optional<UnsafeMutablePointer<Int8>>>) -> Int32 {
bb0(%0 : $Int32, %1 : $UnsafeMutablePointer<Optional<UnsafeMutablePointer<Int8>>>):
%2 = integer_literal $Builtin.Int32, 0 // user: %3
%3 = struct $Int32 (%2) // user: %4
return %3 // id: %4
} // end sil function 'main'
// A.x.getter
// Isolation: nonisolated
sil hidden [transparent] @$s4main1AC1xSivg : $@convention(method) (@guaranteed A) -> Int {
// %0 "self" // users: %2, %1
bb0(%0 : $A):
debug_value %0, let, name "self", argno 1 // id: %1
%2 = ref_element_addr [immutable] %0, #A.x // user: %3
%3 = load %2 // user: %4
return %3 // id: %4
} // end sil function '$s4main1AC1xSivg'
// A.__allocating_init()
// Isolation: nonisolated
sil hidden [exact_self_class] @$s4main1ACACycfC : $@convention(method) (@thick A.Type) -> @owned A {
// %0 "$metatype"
bb0(%0 : $@thick A.Type):
%1 = alloc_ref $A // user: %3
// function_ref A.init()
%2 = function_ref @$s4main1ACACycfc : $@convention(method) (@owned A) -> @owned A // user: %3
%3 = apply %2(%1) : $@convention(method) (@owned A) -> @owned A // user: %4
return %3 // id: %4
} // end sil function '$s4main1ACACycfC'
// A.init()
// Isolation: nonisolated
sil hidden @$s4main1ACACycfc : $@convention(method) (@owned A) -> @owned A {
// %0 "self" // users: %5, %7, %2, %1
bb0(%0 : $A):
debug_value %0, let, name "self", argno 1 // id: %1
%2 = builtin "initializeDefaultActor"(%0) : $()
%3 = integer_literal $Builtin.Int64, 0 // user: %4
%4 = struct $Int (%3) // user: %6
%5 = ref_element_addr %0, #A.x // user: %6
store %4 to %5 // id: %6
%7 = end_init_let_ref %0 // user: %8
return %7 // id: %8
} // end sil function '$s4main1ACACycfc'
// Int.init(_builtinIntegerLiteral:)
// Isolation: unspecified
sil public_external [transparent] @$sSi22_builtinIntegerLiteralSiBI_tcfC : $@convention(method) (Builtin.IntLiteral, @thin Int.Type) -> Int {
// %0 // user: %2
bb0(%0 : $Builtin.IntLiteral, %1 : $@thin Int.Type):
%2 = builtin "s_to_s_checked_trunc_IntLiteral_Int64"(%0) : $(Builtin.Int64, Builtin.Int1) // user: %3
%3 = tuple_extract %2, 0 // user: %4
%4 = struct $Int (%3) // user: %5
return %4 // id: %5
} // end sil function '$sSi22_builtinIntegerLiteralSiBI_tcfC'
// A.deinit
// Isolation: unspecified
sil hidden @$s4main1ACfd : $@convention(method) (@guaranteed A) -> @owned Builtin.NativeObject {
// %0 "self" // users: %3, %2, %1
bb0(%0 : $A):
debug_value %0, let, name "self", argno 1 // id: %1
%2 = builtin "destroyDefaultActor"(%0) : $()
%3 = unchecked_ref_cast %0 to $Builtin.NativeObject // user: %4
return %3 // id: %4
} // end sil function '$s4main1ACfd'
// A.__deallocating_deinit
// Isolation: nonisolated
sil hidden @$s4main1ACfD : $@convention(method) (@owned A) -> () {
// %0 "self" // users: %3, %1
bb0(%0 : $A):
debug_value %0, let, name "self", argno 1 // id: %1
// function_ref A.deinit
%2 = function_ref @$s4main1ACfd : $@convention(method) (@guaranteed A) -> @owned Builtin.NativeObject // user: %3
%3 = apply %2(%0) : $@convention(method) (@guaranteed A) -> @owned Builtin.NativeObject // user: %4
%4 = unchecked_ref_cast %3 to $A // user: %5
dealloc_ref %4 // id: %5
%6 = tuple () // user: %7
return %6 // id: %7
} // end sil function '$s4main1ACfD'
// A.unownedExecutor.getter
// Isolation: nonisolated
sil hidden [available 10.15] [_semantics "defaultActor"] @$s4main1AC15unownedExecutorScevg : $@convention(method) (@guaranteed A) -> UnownedSerialExecutor {
// %0 "self" // users: %3, %1
bb0(%0 : $A):
debug_value %0, let, name "self", argno 1 // id: %1
%2 = metatype $@thin UnownedSerialExecutor.Type // user: %5
%3 = builtin "buildDefaultActorExecutorRef"<A>(%0) : $Builtin.Executor // user: %5
// function_ref UnownedSerialExecutor.init(_:)
%4 = function_ref @$sSceySceBecfC : $@convention(method) (Builtin.Executor, @thin UnownedSerialExecutor.Type) -> UnownedSerialExecutor // user: %5
%5 = apply %4(%3, %2) : $@convention(method) (Builtin.Executor, @thin UnownedSerialExecutor.Type) -> UnownedSerialExecutor // user: %6
return %5 // id: %6
} // end sil function '$s4main1AC15unownedExecutorScevg'
// protocol witness for Actor.unownedExecutor.getter in conformance A
sil private [transparent] [thunk] @$s4main1ACScAAAScA15unownedExecutorScevgTW : $@convention(witness_method: Actor) (@guaranteed A) -> UnownedSerialExecutor {
// %0 // user: %2
bb0(%0 : $A):
// function_ref A.unownedExecutor.getter
%1 = function_ref @$s4main1AC15unownedExecutorScevg : $@convention(method) (@guaranteed A) -> UnownedSerialExecutor // user: %2
%2 = apply %1(%0) : $@convention(method) (@guaranteed A) -> UnownedSerialExecutor // user: %3
return %2 // id: %3
} // end sil function '$s4main1ACScAAAScA15unownedExecutorScevgTW'
// AWrapper.a.getter
// Isolation: unspecified
sil hidden [transparent] @$s4main8AWrapperV1aAA1ACvg : $@convention(method) (@guaranteed AWrapper) -> @owned A {
// %0 "self" // users: %2, %1
bb0(%0 : $AWrapper):
debug_value %0, let, name "self", argno 1 // id: %1
%2 = struct_extract %0, #AWrapper.a // users: %4, %3
strong_retain %2 // id: %3
return %2 // id: %4
} // end sil function '$s4main8AWrapperV1aAA1ACvg'
// AWrapper.x.getter
// Isolation: unspecified
sil hidden @$s4main8AWrapperV1xSivg : $@convention(method) (@guaranteed AWrapper) -> Int {
// %0 "self" // users: %2, %1
bb0(%0 : $AWrapper):
debug_value %0, let, name "self", argno 1 // id: %1
%2 = struct_extract %0, #AWrapper.a // user: %3
%3 = ref_element_addr [immutable] %2, #A.x // user: %4
%4 = load %3 // user: %5
return %4 // id: %5
} // end sil function '$s4main8AWrapperV1xSivg'
// UnownedSerialExecutor.init(_:)
// Isolation: unspecified
sil [available 12.0.0] @$sSceySceBecfC : $@convention(method) (Builtin.Executor, @thin UnownedSerialExecutor.Type) -> UnownedSerialExecutor
sil_vtable A {
#A.init!allocator: (A.Type) -> () -> A : @$s4main1ACACycfC // A.__allocating_init()
#A.deinit!deallocator: @$s4main1ACfD // A.__deallocating_deinit
}
sil_witness_table hidden A: Actor module main {
method #Actor.unownedExecutor!getter: <Self where Self : Actor> (Self) -> () -> UnownedSerialExecutor : @$s4main1ACScAAAScA15unownedExecutorScevgTW // protocol witness for Actor.unownedExecutor.getter in conformance A
}
// Mappings from '#fileID' to '#filePath':
// 'main/debug-sil-actor.swift' => 'debug-sil-actor.swift'
|
Getting this crash using the non-Xcode toolchain struct Triangle<CollisionAttributes: CollisionAttributesGroup>: ~Copyable {
@usableFromInline
internal var mesh: CollisionMesh
@usableFromInline
internal let indices: TriangleIndices
@inlinable
public var p1: Position3 {
let baseIndex = self.indices.p1
let x = self.mesh.components.positions[baseIndex]
let y = self.mesh.components.positions[baseIndex + 1]
let z = self.mesh.components.positions[baseIndex + 2]
return Position3(x, y, z)
}
...
}
|
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 itself
crash
Bug: A crash, i.e., an abnormal termination of software
move-only
Feature → type declarations: Move-only type declarations
ownership
Feature: Ownership modifiers and semantics
SIL
SILOptimizer
Area → compiler: SIL optimization passes
Description
this errors with “this is a compiler bug” on 5.10, and crashes on main.
Reproduction
Stack dump
Expected behavior
it should not crash
Environment
Swift version 6.0-dev (LLVM 57177aa1b91540b, Swift 8be6286)
Target: x86_64-unknown-linux-gnu
Additional information
No response
The text was updated successfully, but these errors were encountered: