File tree Expand file tree Collapse file tree 2 files changed +24
-0
lines changed Expand file tree Collapse file tree 2 files changed +24
-0
lines changed Original file line number Diff line number Diff line change @@ -2243,6 +2243,10 @@ class SILVerifier : public SILVerifierBase<SILVerifier> {
2243
2243
require (
2244
2244
F.hasOwnership (),
2245
2245
" Inst with qualified ownership in a function that is not qualified" );
2246
+ if (EBI->getOperand ()->getType ().isAddress ()) {
2247
+ require (isa<StoreBorrowInst>(EBI->getOperand ()),
2248
+ " end_borrow of an address not produced by store_borrow" );
2249
+ }
2246
2250
}
2247
2251
2248
2252
void checkEndLifetimeInst (EndLifetimeInst *I) {
Original file line number Diff line number Diff line change
1
+ // RUN: %target-sil-opt -emit-sorted-sil -verify-continue-on-failure -o /dev/null %s 2>&1 | %FileCheck %s
2
+ // REQUIRES: asserts
3
+
4
+ sil_stage canonical
5
+
6
+ import Builtin
7
+ import Swift
8
+ import SwiftShims
9
+
10
+ class C {}
11
+
12
+ // CHECK: Begin Error in function end_borrow_1_addr_alloc_stack
13
+ // CHECK-NEXT: SIL verification failed: end_borrow of an address not produced by store_borrow
14
+ sil [ossa] @end_borrow_1_addr_alloc_stack : $@convention(thin) () -> () {
15
+ %addr = alloc_stack $C
16
+ end_borrow %addr : $*C
17
+ dealloc_stack %addr : $*C
18
+ %retval = tuple ()
19
+ return %retval : $()
20
+ }
You can’t perform that action at this time.
0 commit comments