You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I expect the test to pass but it fails. It used to pass with 0.12.0-dev.3405+31791ae15
I can understand why it's failing: I'm setting the smaller field of the packed union so the extra bits are probably undefined? Should I be setting the largest field always?
I'm willing to accept this is my problem and not yours but wanted to raise it in case you believe this is a regression.
The text was updated successfully, but these errors were encountered:
mitchellh
added
the
bug
Observed behavior contradicts documented or intended behavior
label
Apr 18, 2024
Yes, I think it's accurate to say that initializing a packed union with a small field leaves the remaining bits undefined, so that code snippet just has a bug. That said, I'll wait for @andrewrk to confirm the intended behavior before closing.
This is indeed working as designed given how unions work in zig: only the active field has a defined value, and the bitcast therefore accesses undefined memory, making cell_int have undefined bits, or be fully undefined, depending on the resolution of #19634.
Zig Version
0.12.0-dev.3674+a0de07760
Steps to Reproduce and Observed Behavior
Expected Behavior
I expect the test to pass but it fails. It used to pass with
0.12.0-dev.3405+31791ae15
I can understand why it's failing: I'm setting the smaller field of the
packed union
so the extra bits are probably undefined? Should I be setting the largest field always?I'm willing to accept this is my problem and not yours but wanted to raise it in case you believe this is a regression.
The text was updated successfully, but these errors were encountered: