0
Fork 0
mirror of https://codeberg.org/ziglang/zig synced 2026-11-18 07:05:05 +00:00
Commit graph

37,545 commits

Author SHA1 Message Date
Kendall Condon
1708da2c71 libfuzzer: fix SkipZigTest with new inputs
It is now ignored for inputs from the corpus to ensure the filesystem
and process corpus stay in sync. For other (nondeterministic) inputs the
input builder is now reset.
2026-03-23 05:19:04 +01:00
Frank Denis
b2c2b4d063 Merge pull request 'crypto: correct aes-siv s2v' (#31623) from sinon/zig:fix-aes-siv into master
Reviewed-on: https://codeberg.org/ziglang/zig/pulls/31623
Reviewed-by: Frank Denis <jedisct1@noreply.codeberg.org>
2026-03-23 03:11:13 +01:00
GasInfinity
1311880eea fix: use no_builtin when including zigc in the Zcu
* oops
2026-03-22 21:11:41 +01:00
rpkak
9857dabfea std.c.MFD: support linux 2026-03-22 18:06:00 +01:00
David Rubin
8efd539305
crypto: correct aes-siv s2v
The first issue is that when len(Sn) >= 128,
we perform Sn xor D instead of the Sn xorend D
that is specified in RFC 5297.

The second issue is that we truncate the Sn
if it is larger than 4096 bytes, which could
lead to collisions between inputs. We solve
this by absoring the Sn into the CMAC state
perform the last 16 bytes, xoring those 16
bytes with D as described in the first issue,
and then updating and squeezing the CMAC.
2026-03-22 07:21:41 -07:00
Jacob Young
ccf8e223f4 std.Io.net: disable unix socket test due to presumed windows kernel bug
Tracked by #31499
2026-03-22 09:37:12 -04:00
Alex Rønne Petersen
cb7d2b0563
Revert "std.Progress: use cmpxchgStrong instead of cmpxchgWeak for locking/unlocking IPC"
This reverts commit b6f99a59a3.

https://codeberg.org/ziglang/zig/pulls/31608#issuecomment-11875362
2026-03-21 14:04:24 +01:00
Matthew Lugg
36c390bf14 Zcu: correctly handle tid when main thread recurses
Resolves: https://codeberg.org/ziglang/zig/issues/31380
2026-03-21 09:56:05 +01:00
Alex Rønne Petersen
b4d134a0d2 Merge pull request 'std: audit (most) usages of cmpxchgWeak' (#31608) from justusk/zig:cmpxchg-xchg into master
Reviewed-on: https://codeberg.org/ziglang/zig/pulls/31608
Reviewed-by: Alex Rønne Petersen <alex@alexrp.com>
2026-03-21 04:14:44 +01:00
Justus Klausecker
1f78e34de0 std.Io.Threaded: make mutexLock() use cmpxchgStrong instead of cmpxchgWeak
As established in 048e38624e and d70bd0b37e, mutexes should use a strong
cmpxchg when attempting to lock to guarantee that they actually succeed
if they aren't locked yet.

Also deletes an unused near-duplicate of `mutexLock()`.
2026-03-21 03:00:50 +01:00
Justus Klausecker
b6f99a59a3 std.Progress: use cmpxchgStrong instead of cmpxchgWeak for locking/unlocking IPC
The `cmpxchgWeak` in `setIpcFile` could lead to the IPC file not being set
even though there's still a slot available because one or more slots were
spuriously skipped.

The `cmpxcheWeak` in `serialize` could lead to an unused IPC slot not
being locked and used even though it could be.
2026-03-21 03:00:50 +01:00
Andrew Kelley
e938344100 Merge pull request 'linux: fix handling of O_TMPFILE flag on filesystems that do not support it' (#31543) from eshom/zig:tmpfile-not-supported into master
Reviewed-on: https://codeberg.org/ziglang/zig/pulls/31543
Reviewed-by: Andrew Kelley <andrew@ziglang.org>
2026-03-21 00:04:10 +01:00
Andrew Kelley
a9e5c72aa8 Io.Uring: simplify openat error handling 2026-03-20 12:18:25 -07:00
eshom
2054a257c2 std.Io.Uring: handle UnsupportedOperation for O_TMPFILE case
Having `std.Io.Uring` contain OpenError error set
allows handling of OperationUnsupported specifically for `.openat`,
while avoiding propagating this error to the more general
`File.OpenError`.

This more specific subset also eliminated 2 unreachable prongs that
previously inherited from `File.OpenError`.

Added comments when handling OperationUnsupported, making it clear it is
an unexpected error when TMPFILE bit is not set.
2026-03-20 12:12:29 -07:00
eshom
5119cf6ffd std.Io.Threaded: syscall with O_TMPFILE flag can return OPNOTSUPP 2026-03-20 12:12:29 -07:00
squidy239
4c3877069d remove various workarounds for issues that are now fixed (#31567)
Reviewed-on: https://codeberg.org/ziglang/zig/pulls/31567
Reviewed-by: Andrew Kelley <andrew@ziglang.org>
Co-authored-by: squidy239 <sachabarsayuracko@gmail.com>
Co-committed-by: squidy239 <sachabarsayuracko@gmail.com>
2026-03-20 19:58:33 +01:00
Jacob Young
83c7aba127 windows: trigger automatic fetching of root certificates 2026-03-20 19:23:48 +01:00
Andrew Kelley
06b85a4fd0 CLI: use zon format for clang options
- plain old data ftw
- 177K -> 151K
- data bypasses Sema

This change is not really important but it was nice to explore best
practices for data like this.

When I measured building the compiler, I found no statistically
significant difference in compilation time.
2026-03-20 06:46:13 +01:00
Jacob Young
982f26bcdd netReceiveOneWindows: fix typo 2026-03-20 00:37:00 -04:00
fardragon
4acecad933 bootstrap.c: work around the gcc sra miscomp using preprocessor checks rather than CLI arg (#31589)
Closes #31577
I've also extended the "good" ranges to fit versions >14.3 and >13.4, since both of these branches have the fix merged so if they ever make a dot release it should be good.

Reviewed-on: https://codeberg.org/ziglang/zig/pulls/31589
Reviewed-by: Andrew Kelley <andrew@ziglang.org>
Co-authored-by: fardragon <michaldrozd@protonmail.ch>
Co-committed-by: fardragon <michaldrozd@protonmail.ch>
2026-03-20 04:55:51 +01:00
Jacob Young
3c8b96df6d windows: use enums for boolean types 2026-03-20 02:25:16 +01:00
Alex Rønne Petersen
30de1678a6 Merge pull request 'basic loongarch32-linux support' (#31587) from alexrp/zig:loongarch32 into master
Reviewed-on: https://codeberg.org/ziglang/zig/pulls/31587
2026-03-20 02:04:25 +01:00
Alex Rønne Petersen
eeb62ef346
std.debug.cpu_context: add loongarch32-linux support 2026-03-19 19:53:03 +01:00
Alex Rønne Petersen
a62d8e3323
std.os.linux: add loongarch32 arch bits
closes https://codeberg.org/ziglang/zig/issues/30948
2026-03-19 19:53:03 +01:00
Alex Rønne Petersen
57db8498df
start: add loongarch32 support 2026-03-19 19:53:03 +01:00
Matthew Lugg
10d523f068
Air.Legalize: fix typo in bitcast legalization
A typo meant that the legalization of vector `@bitCast` was literally
just not considering the operand. Oops!

We had a behavior test which should have caught this, but it wasn't
really testing the right thing, so failed to do so. I've updated it to
test what it's supposed to test, so it fails before this patch and
passes after this patch.

Resolves: https://github.com/ziglang/zig/issues/26008
2026-03-19 15:41:22 +00:00
Alex Rønne Petersen
10256e1b81 std.Build.WebServer: fix endianness of written update/exit messages 2026-03-19 10:44:21 +01:00
Jacob Young
9ac1386c10 std.Io.Threaded: windows networking without ws2_32 2026-03-18 20:13:59 -04:00
Alex Rønne Petersen
08416b44f9
ci: build compiler for baseline instead of spacemit_x60 on riscv64-linux 2026-03-18 22:29:01 +01:00
UraniaZPM
485b996b61 Make benchmarking use std.Io.Clock.awake for timing (#31553)
In #31086, the `std.time.Timer` struct was removed, but this broke the last few programs that used it, those being the benchmarking programs for `std.Random`, `std.hash`, `std.crypto` and `std.unicode`. One more is `zig/perf_test.zig`, but as far as I can tell, that one is broken due to changes in file import rules too, unless I'm launching it wrong.

I also spotted some performance and benchmarking issues with the RNGs, detailed in #31554.

Reviewed-on: https://codeberg.org/ziglang/zig/pulls/31553
Reviewed-by: Andrew Kelley <andrew@ziglang.org>
Co-authored-by: UraniaZPM <uraniazpm@noreply.codeberg.org>
Co-committed-by: UraniaZPM <uraniazpm@noreply.codeberg.org>
2026-03-18 21:00:08 +01:00
Andrew Kelley
ce1f7136ae Merge pull request 'cbe: fix switch statements on large types' (#31557) from justusk/zig:cbe-switch-128 into master
Reviewed-on: https://codeberg.org/ziglang/zig/pulls/31557
2026-03-18 20:57:04 +01:00
Justus Klausecker
c10089d060 test: enable 'switch arbitrary int size' behavior test for cbe
was disabled in b25d93e7d9
2026-03-18 16:57:40 +01:00
Justus Klausecker
0b857eebeb test: disable 'switch on large types' behavior tests for wasm backend
The self-hosted wasm backend doesn't properly support very large integers yet.
2026-03-18 15:49:14 +01:00
Justus Klausecker
dbe787a984 Revert "test: disable switch behavior test switching on type >64bits for cbe"
This reverts commit e91654b1e7.
2026-03-18 15:49:14 +01:00
Justus Klausecker
047df44d71 cbe: fix switch statements on large types
`switch` statements on types >128bits are now lowered to conditionals.
This is necessary because Zig lowers integers with more than 128 bits to
bigints, which are not 'native' integers and thus cannot be used as case
values.
128-bit integers get special treatment because Zig will emit actual 128bit
ints if they are supported by the target. They still *may* be lowered to
bigints though, e.g. for 32-bit targets or MSVC. To solve this, this commit
adds a bunch of switch macros to `zig.h` which will either resolve to an
actual `switch` statement or to conditionals. The `if` statements this
approach can generate are not as optimal as they could be but I think this
is a good trade-off since the generated `switch` statements are still the
same as the ones generated for smaller integers. Also the macros result
in pretty readable code.
2026-03-18 15:47:18 +01:00
Andrew Kelley
820308b3d4 Merge pull request 'libzigc: Implement tanhf, tanh, modfl, modff, modf, acoshf, asin' (#31536) from mihael/zig:libzigc/more-math-functions into master
Reviewed-on: https://codeberg.org/ziglang/zig/pulls/31536
Reviewed-by: Andrew Kelley <andrew@ziglang.org>
2026-03-18 06:34:19 +01:00
Andrew Kelley
f8997aca8f Merge pull request 'llvm: some random fixes' (#31552) from llvm-fixes into master
Reviewed-on: https://codeberg.org/ziglang/zig/pulls/31552
Reviewed-by: Andrew Kelley <andrew@ziglang.org>
2026-03-18 01:02:55 +01:00
Matthew Lugg
85837de476 llvm: solve a bunch of alignment bugs
I went over a bunch of calls to `std.zig.llvm.Builder.{load,store}` and
added correct alignments where we previously passed the default
alignment. This fixes some miscompilations, particularly when using
underaligned pointers or *overaligned* slices. I have definitely missed
some cases, but it's better to get some fixes in than for this to sit in
a `git stash` forever.

Resolves: https://codeberg.org/ziglang/zig/issues/31473
Resolves: https://codeberg.org/ziglang/zig/issues/30566
2026-03-18 01:02:29 +01:00
Matthew Lugg
0a2f663281 llvm: solve a misc TODO
The compiler has had the desired semantics for comptime evaluation of
these checks for quite a while now.
2026-03-18 01:02:29 +01:00
Matthew Lugg
6ae30662dc llvm: incremental updates for "is named enum value" functions
It was fairly straightforward to at least theoretically handle
incremental updates to the fields of an enum type correctly: we just
build a new set of instructions, and `std.zig.llvm.Builder` already
knows how to replace the old function body with the new one when we call
`WipFunction.finish`.

Also tightened a few error sets.
2026-03-18 01:02:29 +01:00
Matthew Lugg
6f7840d589 llvm: disable loop vectorization for now
https://github.com/llvm/llvm-project/issues/186922 is pretty serious for
us, because it is causing the Zig compiler itself to get miscompiled in
many common configurations. I don't feel comfortable trying to work
around this by disabling certain CPU features, because that seems
incredibly brittle. I think it's probably best we disable loop
vectorization entirely until we upgrade to a version of LLVM where this
bug is fixed.

This will pessimise codegen in some cases, which is unfortunate, but
that's preferable to miscompilations.
2026-03-18 01:02:29 +01:00
Matthew Lugg
032319c942 llvm: disable loop vectorization for now
https://github.com/llvm/llvm-project/issues/186922 is pretty serious for
us, because it is causing the Zig compiler itself to get miscompiled in
many common configurations. I don't feel comfortable trying to work
around this by disabling certain CPU features, because that seems
incredibly brittle. I think it's probably best we disable loop
vectorization entirely until we upgrade to a version of LLVM where this
bug is fixed.

This will pessimise codegen in some cases, which is unfortunate, but
that's preferable to miscompilations.
2026-03-18 00:56:56 +01:00
Antonin Décimo
83add375c4 zld: fix null dereference parsing Mach-O non-existing atom or FDE
If the unwind record address has not been added to
`superposition` (maybe it is not in the current symbol table mapping?)
then there's a panic on null dereference. Ensure the entry exists in
`superposition`.
2026-03-18 00:45:50 +01:00
mihael
153990d407
libzigc: Remove qemu-riscv comment 2026-03-17 23:33:10 +01:00
mihael
691416c24d
libzigc: Implement tanhf
The changes were tested by running:

```
$ ./build/stage3/bin/zig build -p stage4 -Denable-llvm -Dno-lib

$ stage4/bin/zig build test-libc -Dlibc-test-path=<LIBC-TEST-PATH> -Dtest-filter=tanhf -fqemu -fwasmtime --summary line
Build Summary: 553/553 steps succeeded
```
2026-03-17 23:33:10 +01:00
mihael
fd680ba5fb
libzigc: Implement tanh
The changes were tested by running following commands:

```
$ ./build/stage3/bin/zig build -p stage4 -Denable-llvm -Dno-lib

$ stage4/bin/zig build test-libc -Dlibc-test-path=<LIBC-TEST-PATH> -Dtest-filter=tanh -fqemu -fwasmtime --summary line
Build Summary: 1289/1289 steps succeeded
```
2026-03-17 23:33:10 +01:00
mihael
4cad6f5372
libzigc: Implement modfl
The changes were tested by running:

```
$ ./build/stage3/bin/zig build -p stage4 -Denable-llvm -Dno-lib

$ stage4/bin/zig build test-libc -Dlibc-test-path=<LIBC-TEST-PATH> -Dtest-filter=modfl -fqemu -fwasmtime --summary line
Build Summary: 369/369 steps succeeded
```
2026-03-17 23:33:10 +01:00
mihael
0141787257
libzigc: implement modff
`modf` function was generalized and renamed to `modfGeneric`, `modf` and
`modff` provide the appropriate type while calling that function. The
unit tests were also generalized so they can be reused for different
float types.

Both `modf` and `modff` were tested after making these changes:
```
$ stage4/bin/zig build test-libc -Dlibc-test-path=<LIBC-TEST-PATH> -Dtest-filter=modf -fqemu -fwasmtime --summary line
Build Summary: 921/921 steps succeeded
```

```
stage4/bin/zig build test-libc -Dlibc-test-path=<LIBC-TEST-PATH> -Dtest-filter=modff -fqemu -fwasmtime --summary line
Build Summary: 369/369 steps succeeded
```
2026-03-17 23:33:10 +01:00
mihael
1c280032aa
libzigc: Assign std.testing functions to consts 2026-03-17 23:33:10 +01:00
mihael
eab22ab2b8
libzigc: Implement modf
The behaviour regarding special cases differs between `libc` and Zig's
`stdlib` for `modf`, so the implementation couldn't be a straightforward
calling of `stdlib` function.

Other than the obvious documented differences, I also had problems with
the `INVALID` flag being raised while running `libc-test` suite on riscv
arch through qemu. The solution was to test if the argument is `NaN`,
and then return a quiet `NaN` if so.

Passing tests, that should include all the special cases to be wary of,
were also added.

Test results:
```
$ stage4/bin/zig build test-libc -Dlibc-test-path=<LIBC-TEST-PATH> -Dtest-filter=modf -fqemu -fwasmtime --summary line
Build Summary: 921/921 steps succeeded
```
2026-03-17 23:33:10 +01:00