Files
swift-mirror/test/SIL/verifier-fail-access-scope.sil
Erik Eckstein 6ce2df2ed1 SIL Verifier: workaround a MoveOnlyChecker pass bug
The MoveOnlyChecker is inserting a `destroy_addr` in a read-only access scope, which is illegal.
Relax the verification of read-only access scope by only looking at dynamic scopes.

Fixes a verifier crash.
rdar://166896665
2025-12-22 10:57:41 +01:00

18 lines
349 B
Plaintext

// RUN: not --crash %target-sil-opt %s -o /dev/null
// REQUIRES: asserts
sil_stage canonical
import Builtin
import Swift
sil [ossa] @write_in_read_only_scope : $@convention(thin) (@inout Int, Int) -> () {
bb0(%0 : $*Int, %1 : $Int):
%2 = begin_access [read] [dynamic] %0
store %1 to [trivial] %0
end_access %2
%5 = tuple()
return %5
}