File tree 1 file changed +6
-3
lines changed
1 file changed +6
-3
lines changed Original file line number Diff line number Diff line change @@ -131,9 +131,12 @@ extern "C" fn foo(x: __m256) -> __m256;
131
131
132
132
fn main () {
133
133
unsafe {
134
- union U { v : __m256 , a : [u64 ; 4 ] }
134
+ #[repr( C )] union U { v : __m256 , a : [u64 ; 4 ] }
135
135
if is_x86_feature_detected! (" avx" ) {
136
- foo (U { a : [0 ; 4 ] }. v);
136
+ // note: this operation is used here for readability
137
+ // but its behavior is currently unspecified (see note above).
138
+ let vec = U { a : [0 ; 4 ] }. v;
139
+ foo (vec );
137
140
}
138
141
}
139
142
}
@@ -212,5 +215,5 @@ target features are enabled at compile-time.
212
215
213
216
* Should it be possible to use, e.g., ` __m128 ` on C FFI when the ` avx ` feature
214
217
is enabled? Does that change the calling convention and make doing so unsafe ?
215
- We could extern this RFC to also require that to use certain types certain
218
+ We could extend this RFC to also require that to use certain types certain
216
219
features must be disabled.
You can’t perform that action at this time.
0 commit comments