aboutsummaryrefslogtreecommitdiff
path: root/test/behavior/pointers.zig
AgeCommit message (Collapse)Author
2024-01-15test/behavior: replace all 'comptime expect' with 'comptime assert'dweiller
2024-01-06categorize `behavior/bugs/<issueno>.zig` testsVeikka Tuominen
2023-11-19test: update behavior to silence 'var is never mutated' errorsmlugg
2023-10-17Sema: disallow `@intFromPtr` for comptime-only typesBogdan Romanyuk
2023-10-15spirv: update failing / passing testsRobin Voetter
Some tests are now failing due to debug info changes, some tests now pass due to improved compiler functionality.
2023-10-15spirv: make air is_null not emit OpPtr(Not)EqualRobin Voetter
2023-10-14tests: enable already passing behaviour tests for self-hosted wasmXavier Bouchoux
1611 passed; 262 skipped; 0 failed. (was: 1543 passed; 330 skipped; 0 failed.)
2023-09-23compiler: preserve result type information through address-of operatormlugg
This commit introduces the new `ref_coerced_ty` result type into AstGen. This represents a expression which we want to treat as an lvalue, and the pointer will be coerced to a given type. This change gives known result types to many expressions, in particular struct and array initializations. This allows certain casts to work which previously required explicitly specifying types via `@as`. It also eliminates our dependence on anonymous struct types for expressions of the form `&.{ ... }` - this paves the way for #16865, and also results in less Sema magic happening for such initializations, also leading to potentially better runtime code. As part of these changes, this commit also implements #17194 by disallowing RLS on explicitly-typed struct and array initializations. Apologies for linking these changes - it seemed rather pointless to try and separate them, since they both make big changes to struct and array initializations in AstGen. The rationale for this change can be found in the proposal - in essence, performing RLS whilst maintaining the semantics of the intermediary type is a very difficult problem to solve. This allowed the problematic `coerce_result_ptr` ZIR instruction to be completely eliminated, which in turn also simplified the logic for inferred allocations in Sema - thanks to this, we almost break even on line count! In doing this, the ZIR instructions surrounding these initializations have been restructured - some have been added and removed, and others renamed for clarity (and their semantics changed slightly). In order to optimize ZIR tag count, the `struct_init_anon_ref` and `array_init_anon_ref` instructions have been removed in favour of using `ref` on a standard anonymous value initialization, since these instructions are now virtually never used. Lastly, it's worth noting that this commit introduces a slightly strange source of generic poison types: in the expression `@as(*anyopaque, &x)`, the sub-expression `x` has a generic poison result type, despite no generic code being involved. This turns out to be a logical choice, because we don't know the result type for `x`, and the generic poison type represents precisely this case, providing the semantics we need. Resolves: #16512 Resolves: #17194
2023-09-23spirv: fix blocks that return no valueRobin Voetter
2023-09-23spirv: constant elem ptrRobin Voetter
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-06-13std.math: hard deprecate obsolete constants (soft deprecated in 0.10)Eric Joldasov
Followup to 5b8ac9821dd25c3e5282130b4d93d6c5b7debb08. 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: ptr_subRobin Voetter
Implments the ptr_sub air tag. The code is unified with that of ptr_add.
2023-05-20spirv: pointer bitcastingRobin Voetter
2023-05-11setup spirv backend in behavior testsAli Chraghi
2023-05-03x86_64: fix feature confusionJacob Young
2023-05-01behavior: update affected tests for the x86_64 backendJacob Young
2023-04-26behavior: update passing cbe testsJacob Young
2023-04-02x86_64: implement large cmpJacob Young
2023-03-25x86_64: implement atomic loopsJacob Young
2023-03-15behavior: enable passing behavior tests on stage2_x86_64Jacob Young
2023-02-23CType: fix lowering of generic function pointerJacob Young
2023-01-22stage2 ARM: add basic debug info for localsjoachimschmidt557
Also disables one behavior test which was failing
2023-01-22type: correct condition for eliding pointer alignment canonicalizationVeikka Tuominen
Closes #14373
2023-01-17AstGen: reset source cursor before generating pointer attributesVeikka Tuominen
These attributes can appear in any order but AstGen expects the source cursor to be incremented in a monotonically increasing order. Closes #14332
2023-01-05std: collect all options under one namespaceVeikka Tuominen
2022-12-27stage2 AArch64: unify callee-preserved regs on all targetsjoachimschmidt557
also enables many passing behavior tests
2022-12-10stage2: sparc64: Skip unimplemented testsKoakuma
2022-12-06remove references to stage1 in behavior testsAndrew Kelley
Good riddance.
2022-11-12llvm: correctly lower references to generic functionsVeikka Tuominen
Closes #13522
2022-10-30behavior: enable fixed cbe testsJacob Young
2022-10-25cbe: add support for all float literals typesJacob Young
2022-10-25cbe: fix atomicsJacob Young
2022-10-25behavior: enable stage2_c tests that are currently passingJacob Young
Also fix C warnings triggered by these tests.
2022-10-05Sema: use correct value when `@ptrCast` operand is comptime knownVeikka Tuominen
Closes #13034
2022-09-10x86_64: pass more behavior testsJakub Konka
2022-09-09stage2 ARM: implement ptr_elem_valjoachimschmidt557
2022-09-09stage2 ARM: implement struct_field_val for registersjoachimschmidt557
2022-09-08Sema: preserve alignment of const decl pointersVeikka Tuominen
Closes #12769
2022-06-25stage2 ARM: implement basic intCast and error union wrappingjoachimschmidt557
2022-05-27stage2 AArch64: complete genTypedValuejoachimschmidt557
2022-05-17stage2: fix pointer arithmetic result typeAndrew Kelley
This makes it so the result of doing pointer arithmetic creates a new pointer type that has adjusted alignment.
2022-05-17behavior tests: correction of C pointer testAndrew Kelley
This test was also covering this behavior: ```zig test "equality of pointers to comptime const" { const a: i32 = undefined; comptime assert(&a == &a); } ``` This check belongs in its own behavior test which isolates this behavior; not bundled along with a C pointer test.
2022-03-23Sema: fix comptime elem_ptr compare fixed addressAndrew Kelley
2022-03-23wasm: Enable all passing testsLuuk de Gram
All tests have been manually verified which are now passing. This means that any remaining TODO is an actual to-be-fixed or to-be-implemented test case.
2022-03-22CBE: enable more passing tests (#11258)Daniele Cocca
2022-03-17CBE: enable more tests that are currently passingDaniele Cocca