aboutsummaryrefslogtreecommitdiff
path: root/test/behavior/pointers.zig
AgeCommit message (Collapse)Author
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
2022-03-16stage2: elem_ptr needs to know if slice or direct accessMitchell Hashimoto
This fixes one of the major issues plaguing the `std.sort` comptime tests. The high level issue is that at comptime, we need to know whether `elem_ptr` is being used to subslice an array-like pointer or access a child value. High-level example: var x: [2][2]i32 = undefined; var a = &x[0]; // elem_ptr, type *[2]i32 var y: [5]i32 = undefined; var b = y[1..3]; // elem_ptr, type *[2]i32 `a` is pointing directly to the 0th element of `x`. But `b` is subslicing the 1st and 2nd element of `y`. At runtime with a well defined memory layout, this is an inconsequential detail. At comptime, the values aren't laid out exactly in-memory so we need to know the difference. This becomes an issue specifically in this case: var c: []i32 = a; var d: []i32 = b; When converting the `*[N]T` to `[]T` we need to know what array to point to. For runtime, its all the same. For comptime, we need to know if its the parent array or the child value. See the behavior tests for more details. This commit fixes this by adding a boolean to track this on the `elem_ptr`. We can't just immediately deref the child for `&x[0]` because it is legal to ptrCast it to a many-pointer, do arithmetic, and then cast it back (see behavior test) so we need to retain access to the "parent" indexable.
2022-03-08stage2: sentinel array init must add sentinel to array valueMitchell Hashimoto
I didn't realize that the `array` value type has the sentinel on it.
2022-03-08stage2: elem vals of many pointers need not deref pointersMitchell Hashimoto
By the time zirElemVal is reached for a many pointer, a load has already happened, making sure the operand is already dereferenced. This makes `mem.sliceTo` now work.
2022-03-07stage2: resolve array type for typed array init expressionsMitchell Hashimoto
Array types with sentinels were not being typed correctly in the translation from ZIR to Sema (comptime). This modifies the `array_init` ZIR to also retain the type of the init expression (note: untyped array initialization is done via the `array_init_anon` ZIR and so is unchanged in this commit).
2022-03-05stage2: test changed behavior of c pointer resolution from stage1Mitchell Hashimoto
stage1 peer resolves the given test to `[*c]u8` but stage2 makes that a const u8. I believe stage2 behavior is correct since the pointer itself is const.
2022-03-03Sema: rework peer type logic for pointersAndrew Kelley
Now it's centered around a switch on the chosen type tag which gives us easy access to pointer data. The logic is simplied and in some cases logic is removed when it is sufficient to choose the type that is a better coercion target without knowing whether such coercion will succeed ahead of time. A bug is fixed at the bottom of the function; we were doing the opposite of what we were supposed to with `seen_const`. Also the bottom of the function has a more complete handling of the possible combinations of `any_are_null`, `convert_to_slice`, and `err_set_ty`. In the behavior tests, not as many backends needed to be skipped.
2022-03-03stage2: peer resolve *T to [*c]TMitchell Hashimoto
2022-03-03stage2: make analyzePtrArithmetic no-op with offset=0Veikka Tuominen