@@ -124,6 +124,9 @@ class ViolateInoutSafetySwitchToObjcBuffer {
124124 // loop calls a function that violates inout safety and overrides the array.
125125 let isNativeTypeChecked = A . _hoistableIsNativeTypeChecked ( )
126126 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.
127130 let t = A . _checkSubscript (
128131 i, wasNativeTypeChecked: isNativeTypeChecked)
129132 _ = A . _getElement (
@@ -141,11 +144,11 @@ class ViolateInoutSafetySwitchToObjcBuffer {
141144
142145ArraySemanticOptzns . test ( " inout_rule_violated_isNativeBuffer " )
143146 . 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 " ) )
146149 . crashOutputMatches (
147- !_isDebugAssertConfiguration ( ) ? " "
148- : hasBackdeployedConcurrencyRuntime ( ) ? " inout rules were violated "
150+ hasBackdeployedConcurrencyRuntime ( )
151+ ? " inout rules were violated "
149152 : " Fatal access conflict detected. "
150153 )
151154 . code {
@@ -170,6 +173,9 @@ class ViolateInoutSafetyNeedElementTypeCheck {
170173 // loop calls a function that violates inout safety and overrides the array.
171174 let isNativeTypeChecked = A . _hoistableIsNativeTypeChecked ( )
172175 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.
173179 let t = A . _checkSubscript (
174180 i, wasNativeTypeChecked: isNativeTypeChecked)
175181 _ = A . _getElement (
@@ -187,11 +193,11 @@ class ViolateInoutSafetyNeedElementTypeCheck {
187193
188194ArraySemanticOptzns . test ( " inout_rule_violated_needsElementTypeCheck " )
189195 . 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 " ) )
192198 . crashOutputMatches (
193- !_isDebugAssertConfiguration ( ) ? " "
194- : hasBackdeployedConcurrencyRuntime ( ) ? " inout rules were violated "
199+ hasBackdeployedConcurrencyRuntime ( )
200+ ? " inout rules were violated "
195201 : " Fatal access conflict detected. "
196202 )
197203 . code {
0 commit comments