Commit graph

7828 commits

Author SHA1 Message Date
Andrew Kelley
9adcc31ca3 update tools and other miscellaneous things to new APIs 2025-08-30 00:48:50 -07:00
Andrew Kelley
fadd268a60 upgrade more old API uses 2025-08-30 00:48:50 -07:00
Andrew Kelley
79f267f6b9 std.Io: delete GenericReader
and delete deprecated alias std.io
2025-08-29 17:14:26 -07:00
Andrew Kelley
4b948e8556
Merge pull request #25036 from ziglang/GenericWriter
std.Io: delete GenericWriter, AnyWriter, and null_writer
2025-08-29 03:48:45 -07:00
Andrew Kelley
640c11171b LLVM backend:fix align 1 sret parameter load returned
closes #25067
2025-08-29 03:37:18 -07:00
Andrew Kelley
f7884961c2 update more to avoid GenericWriter 2025-08-28 18:30:57 -07:00
Andrew Kelley
4f510dba10 behavior tests: remove "variadic functions" dependency on std lib 2025-08-28 18:30:57 -07:00
Andrew Kelley
ea3471288a update GenericWriter usage found by test-cases 2025-08-28 18:30:57 -07:00
David Rubin
73a0b5441b
AstGen: forward result type through unary float builtins
Uses a new `float_op_result_ty` ZIR instruction tag.
2025-08-28 15:46:12 +01:00
mlugg
a31950aa57 std.debug: remove @frameAddress() "UAF"
We can't call `@frameAddress()` and then immediately `return`! That
invalidates the frame. This *usually* isn't a problem, because the stack
walk `next` call will *probably* have a stack frame and it will
*probably* be at the exact same address, but neither of those is a
guarantee. On powerpc, presumably some unfortunate inlining was going
on, so this frame was indeed invalidated when we started walking frames.

We need to explicitly pass `@frameAddress` into any function which will
return before we actually walk the stack. Pretty simple patch.

Resolves: #24970
2025-08-28 10:56:11 +01:00
Maciej 'vesim' Kuliński
ff859088e4 std.Target: add vita os
Co-authored-by: Alex Rønne Petersen <alex@alexrp.com>
2025-08-26 07:50:06 +02:00
Alex Rønne Petersen
5d019abe4e start adding big endian RISC-V support
The big endian RISC-V effort is mostly driven by MIPS (the company) which is
pivoting to RISC-V, and presumably needs a big endian variant to fill the niche
that big endian MIPS (the ISA) did.

GCC already supports these targets, but LLVM support will only appear in 22;
this commit just adds the necessary target knowledge and checks on our end.
2025-08-25 16:15:17 +02:00
GasInfinity
fca2a7a638 test(llvm_targets): remove unused thumb-3ds 2025-08-22 04:14:53 +02:00
GasInfinity
cc71936eb9 feat(std.Target): add 3ds os 2025-08-22 04:14:53 +02:00
Andrew Kelley
001ec07772
Merge pull request #24249 from antlilja/dwarf-extern-arg
Fix compiler crash when passing a comptime extern function arg to a function
2025-08-18 13:25:13 -07:00
Andrew Kelley
ef14c73245 Compilation: remove last instance of deprecatedReader
This also makes initStreaming preemptively disable file size checking.
2025-08-16 14:46:20 -07:00
antlilja
52178d14b0 Add test for passing extern function to function 2025-08-15 18:29:06 -04:00
Jacob Young
375bc2d7b5 Dwarf: implement comptime-known extern values
Closes #24259
2025-08-15 18:29:06 -04:00
Andrew Kelley
2201f74d7f disable failing test on windows
tracked by #24867
2025-08-15 13:34:19 -07:00
mlugg
8adabaa4ed Zcu: don't tell linkers about exports if there are compile errors
In the best case, this is redundant work, because we aren't actually
going to emit a working binary this update. In the worst case, it causes
bugs because the linker may not have *seen* the thing being exported due
to the compile errors.

Resolves: #24417
2025-08-15 20:00:30 +01:00
Will Lillis
e9eee8dace fix: print error set members in a consistent order
Co-authored-by: Matthew Lugg <mlugg@mlugg.co.uk>
2025-08-15 07:43:46 +01:00
Alex Rønne Petersen
6317417fe1
test: enable tsan test for x86_64-netbsd 2025-08-14 08:25:50 +02:00
Matthew Lugg
b87b958687
Merge pull request #24816 from mlugg/small-fixes
two small fixes
2025-08-13 23:55:21 +01:00
Matthew Lugg
a495628862
Merge pull request #24674 from Justus2308/undef-shift-bitwise
Sema: Improve comptime arithmetic undef handling
2025-08-13 14:04:59 +01:00
David Rubin
8e02f9f70d sema: strip @splat operand result type before checking it 2025-08-13 13:55:57 +01:00
Matthew Lugg
6e90ce2536
Merge pull request #24381 from Justus2308/switch-better-underscore
Enhance switch on non-exhaustive enums
2025-08-13 13:54:15 +01:00
mlugg
ba6abd71c2
llvm: unions which are equivalent to enums are not by-ref
The LLVM backend lowers unions where all fields are zero-bit as
equivalent to their backing enum, and expects them to have the same
by-ref-ness in at least one place in the backend, probably more.

Resolves: #23577
2025-08-13 11:36:16 +01:00
Alex Rønne Petersen
662303d7e7
Merge pull request #24734 from Rexicon226/tsan-fix 2025-08-13 08:57:52 +02:00
Justus Klausecker
4ec421372f add remaining undef value tests ; fix @truncate undef retval type 2025-08-12 16:33:58 +02:00
Justus Klausecker
f0ffe30f2f add undef shift tests ; mirror zirShl logic for @shlWithOverflow 2025-08-12 16:33:58 +02:00
Justus Klausecker
79756e681d remove redundant test cases 2025-08-12 16:33:58 +02:00
Justus Klausecker
05762ca02f address most comments 2025-08-12 16:33:57 +02:00
Justus Klausecker
0ef26d113a make >> a compile error with any undef arg ; add a bunch of test cases 2025-08-12 16:33:57 +02:00
Justus Klausecker
d0586da18e Sema: Improve comptime arithmetic undef handling
This commit expands on the foundations laid by https://github.com/ziglang/zig/pull/23177
and moves even more `Sema`-only functionality from `Value`
to `Sema.arith`. Specifically all shift and bitwise operations,
`@truncate`, `@bitReverse` and `@byteSwap` have been moved and
adapted to the new rules around `undefined`.

Especially the comptime shift operations have been basically
rewritten, fixing many open issues in the process.

New rules applied to operators:
* `<<`, `@shlExact`, `@shlWithOverflow`, `>>`, `@shrExact`: compile error if any operand is undef
* `<<|`, `~`, `^`, `@truncate`, `@bitReverse`, `@byteSwap`: return undef if any operand is undef
* `&`, `|`: Return undef if both operands are undef, turn undef into actual `0xAA` bytes otherwise

Additionally this commit canonicalizes the representation of
aggregates with all-undefined members in the `InternPool` by
disallowing them and enforcing the usage of a single typed
`undef` value instead. This reduces the amount of edge cases
and fixes a bunch of bugs related to partially undefined vecs.

List of operations directly affected by this patch:
* `<<`, `<<|`, `@shlExact`, `@shlWithOverflow`
* `>>`, `@shrExact`
* `&`, `|`, `~`, `^` and their atomic rmw + reduce pendants
* `@truncate`, `@bitReverse`, `@byteSwap`
2025-08-12 16:33:57 +02:00
Andrew Kelley
749f10af49 std.ArrayList: make unmanaged the default 2025-08-11 15:52:49 -07:00
Jacob Young
38dfa6537e cbe: emit nonstring attribute
Closes #24545
2025-08-11 11:30:51 -07:00
David Rubin
826b33863f test: add a standalone test for compiling tsan 2025-08-11 03:02:54 +02:00
Ali Cheraghi
64563e2fff
test: skip tests that were not meant to pass for spirv 2025-08-09 13:27:45 +03:30
Andrew Kelley
3fb86841cc
Merge pull request #24661 from alichraghi/spv4
spirv: refactor and remove deduplication ISel
2025-08-07 20:55:50 -07:00
Justus Klausecker
0ecbd5a0e1 address comments 2025-08-07 13:58:49 +02:00
Justus Klausecker
ba549a7d67 Add support for both '_' and 'else' prongs at the same time in switch statements
If both are used, 'else' handles named members and '_' handles
unnamed members. In this case the 'else' prong will be unrolled
to an explicit case containing all remaining named values.
2025-08-07 13:58:47 +02:00
Justus Klausecker
1d9b1c0212 Permit explicit tags with '_' switch prong
Mainly affects ZIR representation of switch_block[_ref]
and special prong (detection) logic for switch.
Adds a new SpecialProng tag 'absorbing_under' that allows
specifying additional explicit tags in a '_' prong which
are respected when checking that every value is handled
during semantic analysis but are not transformed into AIR
and instead 'absorbed' by the '_' branch.
2025-08-07 13:57:57 +02:00
Matthew Lugg
fd9cfc39f5
Merge pull request #24199 from Justus2308/24106-fmt-casts
zig fmt: canonicalize nested cast builtin order
2025-08-07 10:55:03 +01:00
mlugg
3de8bbd3d4 Sema: fix initializing comptime-known constant with OPV union field
Resolves: #24716
2025-08-06 20:47:03 +01:00
Alex Rønne Petersen
7ee6dab39f Revert "Sema: Stop adding Windows implib link inputs for extern "..." syntax."
This reverts commit b461d07a54.

After some discussion in the team, we've decided that this is too disruptive,
especially because the linker errors are less than helpful. That's a fixable
problem, so we might reconsider this in the future, but revert it for now.
2025-08-06 06:15:13 +02:00
Justus Klausecker
7c35070b90 zig fmt: apply new cast builtin order 2025-08-03 14:59:56 +02:00
Alex Rønne Petersen
a5f891d0b3
Merge pull request #24562 from h57624paen/fix-win-spawn-double-normalize
std.process.Child: fix double path normalization in spawnWindows
2025-08-03 11:19:10 +02:00
Matthew Lugg
c80aa9f719
Merge pull request #22997 from Rexicon226/align-0-reify
sema: compile error on reifying align(0) fields and pointers
2025-08-03 09:58:23 +01:00
David Rubin
e82d67233b
disallow alignment on packed union fields 2025-08-02 09:51:26 -07:00
Alex Rønne Petersen
239efa7e67
Merge branch 'riscv-ci' 2025-08-02 09:41:04 +02:00