-
Notifications
You must be signed in to change notification settings - Fork 13.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
transmute + tuple access + eq on repr(simd)
's inner value seems UB to valgrind
#113465
Comments
This sounds like a repeat of rust-lang/portable-simd#339 (we don't have an issue for the problem just a PR for a fix, the report is on Zulip) |
When we finish removing the SIMD tuples, we should catch attempting to use rust/library/portable-simd/crates/core_simd/src/vector.rs Lines 96 to 105 in eee6b31
|
@celinval Could you explain your use case for wanting |
repr(simd)
structure triggers undefined behaviorrepr(simd)
's inner value seems UB to valgrind
repr(simd)
's inner value seems UB to valgrindrepr(simd)
's inner value seems UB to valgrind
Yes, sorry, I know it's a very specialized use case. I am trying to model In my implementation, I was using transmute to extract the content of the Simd structure, so I was trying to transmute the input into a Simd structure I own (with the same layout). The code crashed when I tried to do that though. While debugging, I realized that even transmuting the Simd structure to the original one triggered UB. Hence, this issue. |
I'm not sure I understand the tuple access part. I'm assuming you mean the member access, right? Is that also being removed?
Yes, that seems like a similar problem. I will try the workaround from the PR you mentioned. Thanks edit: @workingjubilee |
Yes, we are discussing it, as |
@workingjubilee should I leave this issue open till then? |
@celinval rust-lang/compiler-team#838 is proposing to just ban that |
The snippet currently makes rustc panic with the following backtrace:
|
That's by design, from #137361 -- make it ICE instead of be UB :P |
I tried this code:
I expected to see this happen: I expected this test to succeed since the destination type is the same as the source type.
Instead, this happened: This test fails. When running it with valgrind, I get errors such as:
Meta
I used the playground version:
The text was updated successfully, but these errors were encountered: