Commit Graph

14809 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
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
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
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
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
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
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
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
mihael c77103add7 libzigc: implement acoshf
The functions 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=acoshf -fqemu -fwasmtime --summary line
Build Summary: 369/369 steps succeeded
```
2026-03-17 23:33:10 +01:00
mihael 69cbe8ea3c libzigc: Implement asin
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=asin -fqemu -fwasmtime --summary line
Build Summary: 921/921 steps succeeded
```
2026-03-17 23:33:10 +01:00
mihael 888014c837 libzigc: std.math -> math
Remove the two uses of `std.math` since that namespace is
already assigned to the `math` constant and used as such.
2026-03-17 23:33:10 +01:00
inf c38e6ed686 feat: remove kernel32.CreateThread, implement ntdll.NtCreateThreadEx inside WindowsThreadImpl (#31519)
Co-authored-by: Ryan Liptak <squeek502@hotmail.com>
Reviewed-on: https://codeberg.org/ziglang/zig/pulls/31519
Reviewed-by: Ryan Liptak <squeek502@noreply.codeberg.org>
Co-authored-by: inf <infirms@protonmail.com>
Co-committed-by: inf <infirms@protonmail.com>
2026-03-17 23:06:55 +01:00
Leslie Lau 4d5721214f fix (Io/Dispatch): alignment type reflection compile errors (#31538)
Fixes compilation errors when using Io.Evented on macOS.

closes #31526

Co-authored-by: Leslie-Lau <804738464@qq.com>
Reviewed-on: https://codeberg.org/ziglang/zig/pulls/31538
Co-authored-by: Leslie Lau <here-leslie-lau@noreply.codeberg.org>
Co-committed-by: Leslie Lau <here-leslie-lau@noreply.codeberg.org>
2026-03-17 18:59:28 +01:00
Techatrix bd89b61a21 lib: always pass process.Environ.Map as const pointer if applicable 2026-03-17 06:28:55 +01:00
Hila Friedman bfd2cc5a3f even tighter return type for std.math.sign (#31485)
The code in #31475 does not return the "smallest integer type that fits possible values" for very small integer types, namely `u0`, `i0`, and `i1` - which all end up with a return type one bit too long. Fixed in this commit.

Reviewed-on: https://codeberg.org/ziglang/zig/pulls/31485
Reviewed-by: Andrew Kelley <andrew@ziglang.org>
Co-authored-by: Hila Friedman <red.black.liquorice@gmail.com>
Co-committed-by: Hila Friedman <red.black.liquorice@gmail.com>
2026-03-17 02:10:27 +01:00
Techatrix 097ca369d5 detect when switch on error shadows it's own switch case capture 2026-03-17 02:05:31 +01:00
Andrew Kelley 2d237da50b Merge pull request 'std.math.pow: fix wrong answer for large even exponents' (#31537) from TemariVirus/zig:master into master
Reviewed-on: https://codeberg.org/ziglang/zig/pulls/31537
Reviewed-by: Andrew Kelley <andrew@ziglang.org>
2026-03-16 23:40:43 +01:00
squidy239 8a8e4a1f04 add cancelable rwlock functions (#31497)
Added cancelable exclusive and shared locking to RwLock. I also added a canceling test for both.

Reviewed-on: https://codeberg.org/ziglang/zig/pulls/31497
Reviewed-by: Andrew Kelley <andrew@ziglang.org>
Co-authored-by: squidy239 <sachabarsayuracko@gmail.com>
Co-committed-by: squidy239 <sachabarsayuracko@gmail.com>
2026-03-16 23:05:00 +01:00
kcbanner 125c1f3dd9 bit_set: specify the backing integer for IntegerBitSet, allowing it to be used in extern structs 2026-03-16 19:07:13 +01:00
TemariVirus e498550952 std.math.pow: organise and add special case tests
Added tests for special cases which were previously untested.
Updated comments to use the same language as IEEE 754-2008.
2026-03-16 15:42:35 +08:00
TemariVirus 06d9ab7121 std.math.pow: fix wrong answer for large even exponents 2026-03-16 15:32:09 +08:00
mlugg abd099e97f Merge pull request 'compiler: fix missing "local variable is never mutated" error' (#31534) from variable-not-mutated into master
Reviewed-on: https://codeberg.org/ziglang/zig/pulls/31534
2026-03-16 00:05:30 +01:00
Yanfeng Liu 584b8f281e zig fmt: remove dead functions
This drops a few dead functions in AutoIndentingStream.

Signed-off-by: Yanfeng Liu <yfliu2008@qq.com>
2026-03-15 21:38:45 +01:00
Matthew Lugg 827a96b1ef compiler: fix missing "local variable is never mutated" error
This regressed back in https://github.com/ziglang/zig/pull/25154. I
didn't get around to fixing it until now, so a few instances of the
warning snuck into the repo over the past few months, which were fixed
in the previous commit. The regression has not appeared in a tagged
release though, so this is not a breaking change in 0.16.0.

Resolves: https://codeberg.org/ziglang/zig/issues/31049
2026-03-15 18:24:32 +00:00
Matthew Lugg 64f1c27332 compiler,std: fix never-mutated local variables 2026-03-15 18:22:13 +00:00
Guillaume 065c6e7946 std.Io.net.HostName: simplify validate logic (#30764)
Follow-up of efe649b13e

Reviewed-on: https://codeberg.org/ziglang/zig/pulls/30764
Reviewed-by: Andrew Kelley <andrew@ziglang.org>
Co-authored-by: Guillaume <guillaume.alabre@gmail.com>
Co-committed-by: Guillaume <guillaume.alabre@gmail.com>
2026-03-15 09:11:11 +01:00