@@ -124,6 +124,9 @@ class ViolateInoutSafetySwitchToObjcBuffer {
124
124
// loop calls a function that violates inout safety and overrides the array.
125
125
let isNativeTypeChecked = A . _hoistableIsNativeTypeChecked ( )
126
126
for i in 0 ..< A . count {
127
+ // Note: the compiler is sometimes able to eliminate this
128
+ // `_checkSubscript` call when optimizations are enabled, skipping the
129
+ // exclusivity check contained within.
127
130
let t = A . _checkSubscript (
128
131
i, wasNativeTypeChecked: isNativeTypeChecked)
129
132
_ = A . _getElement (
@@ -141,11 +144,11 @@ class ViolateInoutSafetySwitchToObjcBuffer {
141
144
142
145
ArraySemanticOptzns . test ( " inout_rule_violated_isNativeBuffer " )
143
146
. skip ( . custom(
144
- { _isFastAssertConfiguration ( ) } ,
145
- reason: " this trap is not guaranteed to happen in -Ounchecked " ) )
147
+ { !_isDebugAssertConfiguration ( ) } ,
148
+ reason: " this trap is not guaranteed to happen in -O or - Ounchecked " ) )
146
149
. crashOutputMatches (
147
- !_isDebugAssertConfiguration ( ) ? " "
148
- : hasBackdeployedConcurrencyRuntime ( ) ? " inout rules were violated "
150
+ hasBackdeployedConcurrencyRuntime ( )
151
+ ? " inout rules were violated "
149
152
: " Fatal access conflict detected. "
150
153
)
151
154
. code {
@@ -170,6 +173,9 @@ class ViolateInoutSafetyNeedElementTypeCheck {
170
173
// loop calls a function that violates inout safety and overrides the array.
171
174
let isNativeTypeChecked = A . _hoistableIsNativeTypeChecked ( )
172
175
for i in 0 ..< A . count {
176
+ // Note: the compiler is sometimes able to eliminate this
177
+ // `_checkSubscript` call when optimizations are enabled, skipping the
178
+ // exclusivity check contained within.
173
179
let t = A . _checkSubscript (
174
180
i, wasNativeTypeChecked: isNativeTypeChecked)
175
181
_ = A . _getElement (
@@ -187,11 +193,11 @@ class ViolateInoutSafetyNeedElementTypeCheck {
187
193
188
194
ArraySemanticOptzns . test ( " inout_rule_violated_needsElementTypeCheck " )
189
195
. skip ( . custom(
190
- { _isFastAssertConfiguration ( ) } ,
191
- reason: " this trap is not guaranteed to happen in -Ounchecked " ) )
196
+ { !_isDebugAssertConfiguration ( ) } ,
197
+ reason: " this trap is not guaranteed to happen in -O or - Ounchecked " ) )
192
198
. crashOutputMatches (
193
- !_isDebugAssertConfiguration ( ) ? " "
194
- : hasBackdeployedConcurrencyRuntime ( ) ? " inout rules were violated "
199
+ hasBackdeployedConcurrencyRuntime ( )
200
+ ? " inout rules were violated "
195
201
: " Fatal access conflict detected. "
196
202
)
197
203
. code {
0 commit comments