aboutsummaryrefslogtreecommitdiff
path: root/test/behavior/struct.zig
AgeCommit message (Collapse)Author
2023-09-23spirv: enable passing testsRobin Voetter
2023-09-23spirv: disable failing testsRobin Voetter
2023-08-11Sema: avoid deleting runtime side-effects in comptime initializersJacob Young
Closes #16744
2023-08-09AstGen: handle `ty` result location for struct and array init correctlymlugg
Well, this was a journey! The original issue I was trying to fix is covered by the new behavior test in array.zig: in essence, `ty` and `coerced_ty` result locations were not correctly propagated. While fixing this, I noticed a similar bug in struct inits: the type was propagated to *fields* fine, but the actual struct init was unnecessarily anonymous, which could lead to unnecessary copies. Note that the behavior test added in struct.zig was already passing - the bug here didn't change any easy-to-test behavior - but I figured I'd add it anyway. This is a little harder than it seems, because the result type may not itself be an array/struct type: it could be an optional / error union wrapper. A new ZIR instruction is introduced to unwrap these. This is also made a little tricky by the fact that it's possible for result types to be unknown at the time of semantic analysis (due to `anytype` parameters), leading to generic poison. In these cases, we must essentially downgrade to an anonymous initialization. Fixing these issues exposed *another* bug, related to type resolution in Sema. That issue is now tracked by #16603. As a temporary workaround for this bug, a few result locations for builtin function operands have been disabled in AstGen. This is technically a breaking change, but it's very minor: I doubt it'll cause any breakage in the wild.
2023-07-31std: finish cleanup up asmJacob Young
This also required implementing the necessary syntax in the x86_64 backend.
2023-07-31cbe: get behavior tests running on armJacob Young
Specifically without linking libc.
2023-07-10Sema: resolve field type layout for anon struct type infoIan Johnson
Closes #16148
2023-06-30Unrevert "Sema: preserve extern struct field alignment"Jacob Young
This unreverts commit 1a2468abfcd8b539193d943c1eefb71319cc7b88.
2023-06-30Remerge pull request #15995 from mlugg/fix/union-field-ptr-alignJacob Young
Sema: copy pointer alignment to union field pointers This is an unrevert of 43c98dc11567eeb38be041c7dad179c53156f3df.
2023-06-30Sema: copy pointer alignment to struct field pointersmlugg
2023-06-29Revert "Merge pull request #15995 from mlugg/fix/union-field-ptr-align"Jacob Young
This reverts commit 40cf3f7ae5fbfb84b7af6b27e6296ee858b209ef, reversing changes made to d98147414d084bc41b00ba9c0be8c7b82ad4e76c.
2023-06-29Revert "Sema: preserve extern struct field alignment"Jacob Young
This reverts commit 4620972d086ebb3b7686a79914876488c6dfd171.
2023-06-28Sema: preserve extern struct field alignmentAlex Kladov
In extern struct { x: u32, y: u16 } we actually know that y's alignment is `@alignOf(u32)`, and not just `@alignOf(u16)`. closes: #16134
2023-06-26Merge pull request #15771 from jacobly0/x86_64-behaviorjacobly0
x86_64: behavior
2023-06-25x86_64: truncate packed field valueJacob Young
2023-06-25x86_64: fix global pointers to packed struct fieldsJacob Young
2023-06-25x86_64: fix packed store crashJacob Young
2023-06-25Sema: copy pointer alignment to struct field pointersmlugg
2023-06-24all: migrate code to new cast builtin syntaxmlugg
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-19all: zig fmt and rename "@XToY" to "@YFromX"Eric Joldasov
Signed-off-by: Eric Joldasov <bratishkaerik@getgoogleoff.me>
2023-06-13all: replace `comptime try` with `try comptime`Eric Joldasov
Signed-off-by: Eric Joldasov <bratishkaerik@getgoogleoff.me>
2023-05-20spirv: ptr_elem_valRobin Voetter
Implements the ptr_elem_val air tag. Implementation is unified with ptr_elem_ptr.
2023-05-20spirv: more passing testsRobin Voetter
2023-05-15x86_64: implement union_initJacob Young
2023-05-11setup spirv backend in behavior testsAli Chraghi
2023-05-03x86_64: fix feature confusionJacob Young
2023-05-03x86_64: implement fieldParentPtrJacob Young
2023-05-01behavior: update affected tests for the x86_64 backendJacob Young
2023-04-25change semantics of `@memcpy` and `@memset`Andrew Kelley
Now they use slices or array pointers with any element type instead of requiring byte pointers. This is a breaking enhancement to the language. The safety check for overlapping pointers will be implemented in a future commit. closes #14040
2023-04-16x86_64: implement packed load and storeJacob Young
2023-04-03x86_64: fix typosJacob Young
2023-04-02x86_64: implement large cmpJacob Young
2023-04-02x86_64: implement aggregate init of a packed structJacob Young
2023-03-25x86_64: implement atomic loopsJacob Young
2023-03-25x86_64: implement struct_field_val for packed containersJacob Young
2023-03-25x86_64: implement struct_field_ptr for packed containersJacob Young
2023-03-21x86_64: (re)implement optional opsJacob Young
Note that this commit also changes the layout of optional for all other backends using `src/codegen.zig` without updating them!
2023-03-15behavior: enable passing behavior tests on stage2_x86_64Jacob Young
2023-02-21behavior: enable passing CBE testsJacob Young
2023-02-19add test coverage for fixed bug. closes #5497Andrew Kelley
2023-01-22Sema: resolve fields before checking tuple lenVeikka Tuominen
Closes #14400
2023-01-16Sema: automatically optimize order of struct fieldsVeikka Tuominen
This is a simple starting version of the optimization described in #168 where the fields are just sorted by order of descending alignment.
2022-12-31add tests for fixed stage1 bugsVeikka Tuominen
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-29add tests for fixed stage1 bugsVeikka Tuominen
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-27Merge pull request #14084 from joachimschmidt557/stage2-aarch64Jakub Konka
stage2 AArch64: small improvements
2022-12-27stage2 AArch64: unify callee-preserved regs on all targetsjoachimschmidt557
also enables many passing behavior tests
2022-12-27llvm: add asserts and behavior tests for #14063Jacob Young
Closes #14063
2022-12-26Sema: add missing `resolveLazyValue` casesJacob Young
Closes #14032
2022-12-25Sema: fix missing struct layout for llvm backendJacob Young
Closes #14063
2022-12-18codegen: fix taking the address of a zero-bit field in a zero-bit structJacob Young
Normally when we want a pointer to the end of a struct we just add 1 to the struct pointer. However, when it is a zero-bit struct, the pointer type being used during lowering is often a dummy pointer type that actually points to a non-zero-bit type, so we actually want to add 0 instead, since a zero-bit struct begins and ends at the same address.