Xavier Bouchoux
405705cb76
codegen: fix byte-aligned field offsets in unaligned nested packed structs
2023-10-03 05:34:19 +00:00
Xavier Bouchoux
62d178e91a
codegen: fix field offsets in packed structs
...
* add nested packed struct/union behavior tests
* use ptr_info.packed_offset rather than trying to duplicate the logic from Sema.structFieldPtrByIndex()
* use the container_ptr_info.packed_offset to account for non-aligned nested structs.
* dedup type.packedStructFieldBitOffset() and module.structPackedFieldBitOffset()
2023-10-03 06:39:20 +02:00
Xavier Bouchoux
8c367ef99a
codegen: fix access to byte-aligned nested packed struct elems
...
When acessing a packed struct member via a byte aligned ptr (from the optimisation in Sema.structFieldPtrByIndex())
the codegen must apply the parent ptr packed_offset in addition to the field offset itself.
resolves https://github.com/ziglang/zig/issues/16609
2023-07-29 18:16:13 +02:00
Xavier Bouchoux
46abf20454
llvm: partial fix of store undefined to packed result location
...
prefer marking too few undefined bits, rather than too many that may overwrite nearby values.
partially resolves https://github.com/ziglang/zig/issues/15337
2023-07-29 11:56:27 +02:00
Andrew Kelley
9d3363fee9
add behavior test for bitcast packed struct twice
...
closes #9914
2023-07-26 19:02:02 -07:00
Jacob Young
5b74278510
x86_64: fix global pointers to packed struct fields
2023-06-25 19:14:03 -04:00
mlugg
f26dda2117
all: migrate code to new cast builtin syntax
...
Most of this migration was performed automatically with `zig fmt`. There
were a few exceptions which I had to manually fix:
* `@alignCast` and `@addrSpaceCast` cannot be automatically rewritten
* `@truncate`'s fixup is incorrect for vectors
* Test cases are not formatted, and their error locations change
2023-06-24 16:56:39 -07:00
Eric Joldasov
50339f595a
all: zig fmt and rename "@XToY" to "@YFromX"
...
Signed-off-by: Eric Joldasov <bratishkaerik@getgoogleoff.me>
2023-06-19 12:34:42 -07:00
Eric Joldasov
d884d7050e
all: replace comptime try with try comptime
...
Signed-off-by: Eric Joldasov <bratishkaerik@getgoogleoff.me>
2023-06-13 23:46:58 +06:00
Robin Voetter
65157d30ab
spirv: ptr_elem_val
...
Implements the ptr_elem_val air tag. Implementation is unified
with ptr_elem_ptr.
2023-05-20 17:30:23 +02:00
Robin Voetter
37aa343079
spirv: more passing tests
2023-05-20 17:30:22 +02:00
Ali Chraghi
ccc490ef68
setup spirv backend in behavior tests
2023-05-11 20:31:52 +02:00
Koakuma
d339e86fb1
stage2: sparc64: Skip unimplemented tests
2023-04-28 16:45:37 -07:00
Jacob Young
894406b9d3
behavior: update passing cbe tests
2023-04-26 19:05:17 -04:00
Jacob Young
bf6fd9ae3f
cbe: enable CI for std tests
2023-04-21 16:36:10 -04:00
Jacob Young
ac68d72d24
x86_64: implement aggregate init of a packed struct
2023-04-02 04:49:53 -04:00
Jacob Young
1e080e5056
x86_64: implement atomic loops
2023-03-25 16:23:55 -04:00
Jacob Young
8f385e77ca
x86_64: implement struct_field_val for packed containers
2023-03-25 16:23:55 -04:00
Jacob Young
0cfc0d0d13
x86_64: implement struct_field_ptr for packed containers
2023-03-25 16:23:55 -04:00
Jacob Young
bdb1e014a0
CBE: cleanup field access
...
* Implement @fieldParentPtr on a union
* Refactor field access to ensure that it is handled consistently
* Remove `renderTypecast` as it is now behaves the same as `renderType`
2023-02-23 00:29:23 -05:00
Veikka Tuominen
6e067dc050
llvm: do not offset packed struct field pointers if they have a host size
...
Closes #14261
2023-01-17 20:28:42 +02:00
Veikka Tuominen
58c1d98c14
add tests for fixed stage1 bugs
...
Closes #4144
Closes #4255
Closes #4372
Closes #4375
Closes #4380
Closes #4417
Closes #4423
Closes #4476
Closes #4528
Closes #4562
Closes #4572
Closes #4597
Closes #4639
Closes #4672
Closes #4782
Closes #4955
Closes #4984
Closes #4997
Closes #5010
Closes #5114
Closes #5166
Closes #5173
Closes #5276
2022-12-31 20:49:02 -05:00
Veikka Tuominen
9a0c593a54
add tests for fixed stage1 bugs
...
Closes #1957
Closes #1994
Closes #2140
Closes #2746
Closes #2802
Closes #2855
Closes #2895
Closes #2981
Closes #3054
Closes #3158
Closes #3234
Closes #3259
Closes #3371
Closes #3376
Closes #3387
Closes #3529
Closes #3653
Closes #3750
Closes #3778
Closes #3882
Closes #3915
Closes #3929
Closes #3961
Closes #3988
Closes #4123
Closes #7448
2022-12-29 12:42:44 +02:00
Koakuma
f9e9ba784f
stage2: sparc64: Skip unimplemented tests
2022-12-10 21:51:46 +07:00
Andrew Kelley
c8aba15c22
remove references to stage1 in behavior tests
...
Good riddance.
2022-12-06 19:06:48 -07:00
Luuk de Gram
090deae41d
wasm: enable behavior tests for packed structs
2022-11-30 21:01:09 +01:00
Jacob Young
48a2783969
cbe: implement optional slice representation change
2022-10-29 05:58:41 -04:00
InKryption
bc72ae5e4e
Sema: Prevent coercion from tuple pointer to mutable slice.
...
Also fix some stdlib code affected by this.
Co-authored by: topolarity <topolarity@tapscott.me>
2022-10-27 22:00:47 -04:00
Jacob Young
ab468d57e3
cbe: implement packed structs
...
Sometimes you have to break a test to make progress :)
2022-10-25 05:11:29 -04:00
Jacob Young
1bab854868
cbe: implement 128-bit and fix smaller integer builtins
2022-10-25 05:11:29 -04:00
Jacob Young
912b84bbad
cbe: fix atomics
2022-10-25 05:11:29 -04:00
Jacob Young
6a4266d62a
cbe: fix infinite recursion on recursive types
2022-10-25 05:11:28 -04:00
Cody Tapscott
83e2d3fb37
stage1: Skip new tests that never passed in stage1
...
This gets the behavior tests passing for stage1 again.
2022-10-13 12:53:20 -07:00
Koakuma
0910cb6fcb
stage2: sparc64: Skip compile-failing tests for now
2022-09-14 16:58:12 -07:00
Veikka Tuominen
4462d08224
stage2 llvm: fix passing packed structs to callconv(.C) functions
...
Closes #12704
2022-09-02 17:57:10 +03:00
Veikka Tuominen
15cc4514e0
Sema: add missing calls to resolveStructLayout
...
Closes #12645
2022-08-28 15:41:21 +03:00
David Gonzalez Martin
da95da438e
Add behavior test coverage for nested packed struct field access
...
Closes #3091
2022-08-26 21:43:38 -04:00
Veikka Tuominen
b0bcd4add2
Sema: allow optional pointers in packed structs
...
Closes #12572
2022-08-22 11:16:36 +03:00
Veikka Tuominen
e47706f344
Sema: validate packed struct field types
2022-08-01 23:59:40 +03:00
Andrew Kelley
f880af369d
LLVM: fix lowering byte-aligned packed struct field pointers
2022-07-27 16:19:23 -07:00
Andrew Kelley
5b7e332b28
disable new behavior test in stage1
...
I regressed this in 379beceffd1b0a0b0d8f3163dc02eba1e53ffa39; sorry
about that.
2022-07-20 16:17:33 -07:00
Andrew Kelley
379beceffd
improve test case from previous commit
...
Now it checks that the code is correctly compiled rather than only checking
that it does not crash the compiler.
2022-07-20 15:21:24 -07:00
Veikka Tuominen
d41dd499a9
stage2 llvm: fix handling of pointer fields in packed structs
2022-07-20 17:07:12 +03:00
Andrew Kelley
3c3bc5af29
Sema: introduce bitSizeAdvanced to recursively resolve types
...
Same pattern as abiSizeAdvanced.
Fixes compiler crash for nested packed structs.
2022-06-10 15:04:39 -07:00
Andrew Kelley
58bc562cb4
update packed struct behavior tests to new language semantics
2022-06-09 20:37:24 -07:00
Andrew Kelley
53c86febcb
stage2: packed struct fixes for big-endian targets
2022-06-07 22:47:08 -07:00
Andrew Kelley
3e30ba3f20
stage2: better codegen for byte-aligned packed struct fields
...
* Sema: handle overaligned packed struct field pointers
* LLVM: handle byte-aligned packed struct field pointers
2022-06-07 21:05:40 -07:00
Andrew Kelley
71e2a56e3e
mark some more behavior tests as passing
2022-05-25 00:12:56 -07:00
Igor Stojkovic
19e343b8d4
stage1: Additional fix for packed structs
2022-04-09 12:43:30 +02:00
Igor Stojkovic
109e730c8c
stage1: Fix packed structs ( #2627 , #10104 )
...
Fixed formatting in packed-struct-zig
Skipped packed_structs tests in stage2
simplified packed struct tests
2022-03-26 09:03:37 +01:00