-
Notifications
You must be signed in to change notification settings - Fork 70
Commit 3818aae
Fix union field access by representing unions as structs in SPIR-V
When a union has multiple fields, represent it as a struct with all fields
at offset 0 instead of just using the largest field. This allows pointer
casts between union fields to work correctly by enabling the
recover_access_chain_from_offset function to find valid access chains.
Fixes #241.1 parent e4375b1 commit 3818aae
File tree
2 files changed
+48
-14
lines changed- crates/rustc_codegen_spirv/src
- tests/ui/lang/core
2 files changed
+48
-14
lines changedLines changed: 16 additions & 14 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
718 | 718 |
| |
719 | 719 |
| |
720 | 720 |
| |
721 | - | ||
722 | - | ||
723 | - | ||
724 | - | ||
725 | - | ||
726 | - | ||
727 | - | ||
728 | - | ||
729 | - | ||
730 | - | ||
731 | - | ||
732 | - | ||
721 | + | ||
722 | + | ||
723 | + | ||
724 | + | ||
725 | + | ||
726 | + | ||
727 | + | ||
728 | + | ||
729 | + | ||
730 | + | ||
731 | + | ||
732 | + | ||
733 | + | ||
734 | + | ||
733 | 735 |
| |
734 | - | ||
735 | - | ||
736 | + | ||
737 | + | ||
736 | 738 |
| |
737 | 739 |
| |
738 | 740 |
| |
|
Lines changed: 32 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
1 | + | ||
2 | + | ||
3 | + | ||
4 | + | ||
5 | + | ||
6 | + | ||
7 | + | ||
8 | + | ||
9 | + | ||
10 | + | ||
11 | + | ||
12 | + | ||
13 | + | ||
14 | + | ||
15 | + | ||
16 | + | ||
17 | + | ||
18 | + | ||
19 | + | ||
20 | + | ||
21 | + | ||
22 | + | ||
23 | + | ||
24 | + | ||
25 | + | ||
26 | + | ||
27 | + | ||
28 | + | ||
29 | + | ||
30 | + | ||
31 | + | ||
32 | + |
0 commit comments