aboutsummaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2025-09-17std.sort.pdq: fix out-of-bounds access in partialInsertionSort (#25253)Frank Denis
* std.sort.pdq: fix out-of-bounds access in partialInsertionSort When sorting a sub-range that doesn't start at index 0, the partialInsertionSort function could access indices below the range start. The loop condition `while (j >= 1)` didn't respect the arbitrary range boundaries [a, b). This changes the condition to `while (j > a)` to ensure indices never go below the range start, fixing the issue where pdqContext would access out-of-bounds indices. Fixes #25250
2025-09-17use block break instead of returnmarko
2025-09-17Merge pull request #25257 from linusg/bump-macos-headersAlex Rønne Petersen
libc: Update macOS headers to SDK 26.0
2025-09-17Avoid logic where we return success in case of an error (#25251)Frank Denis
In ed25519.zig, we checked if a test succeeds, in which case we returned an error. This was confusing, and Andrew pointed out that Zig weights branches against errors by default.
2025-09-17Some miscellaneous test suite cleanups (#25256)Alex Rønne Petersen
* test: remove test-compare-output and test-asm-link tests These were low value and unfocused tests. We already have coverage of the important aspects of these tests elsewhere. Additionally, there was really no need for these to have their own test harness. * test: rename issue_8550 standalone test to compile_asm * test: rename backend=stage2 to backend=selfhosted, and add backend=auto backend=auto (now the default if backend is omitted) means to let the compiler pick whatever backend it wants as the default. This is important for platforms where we don't yet have a self-hosted backend, such as loongarch64. Also purge a bunch of redundant target=native. * test: delete old stage1 compile_errors tests generic_function_returning_opaque_type.zig was salvaged as it's still worth having. * test: pull tests in test/cases/llvm/ up to test/cases/ There is nothing inherently LLVM-specific about any of these. * test: remove @cImport usage in interdependent_static_c_libs * test: move glibc_compat from link to standalone tests This is not really testing the linker. * build: -Dskip-translate-c now implies -Dskip-run-translated-c * build: skip test-cimport when -Dskip-translate-c is given
2025-09-16build: skip test-cimport when -Dskip-translate-c is givenAlex Rønne Petersen
2025-09-16build: -Dskip-translate-c now implies -Dskip-run-translated-cAlex Rønne Petersen
2025-09-16test: move glibc_compat from link to standalone testsAlex Rønne Petersen
This is not really testing the linker.
2025-09-16test: remove @cImport usage in interdependent_static_c_libsAlex Rønne Petersen
2025-09-16test: pull tests in test/cases/llvm/ up to test/cases/Alex Rønne Petersen
There is nothing inherently LLVM-specific about any of these.
2025-09-16test: delete old stage1 compile_errors testsAlex Rønne Petersen
generic_function_returning_opaque_type.zig was salvaged as it's still worth having.
2025-09-16test: rename backend=stage2 to backend=selfhosted, and add backend=autoAlex Rønne Petersen
backend=auto (now the default if backend is omitted) means to let the compiler pick whatever backend it wants as the default. This is important for platforms where we don't yet have a self-hosted backend, such as loongarch64. Also purge a bunch of redundant target=native.
2025-09-16Parallelize deriveKeysFrank Denis
2025-09-16Import crypto/aes_gcm_siv.zigFrank Denis
2025-09-16libc: Update macOS headers to SDK 26.0Linus Groh
2025-09-16tools: Update fetch_them_macos_headers.zig for macOS 26Linus Groh
2025-09-16llvm: fix tagged union payload size in debug infomlugg
Resolves: #24415
2025-09-16test: rename issue_8550 standalone test to compile_asmAlex Rønne Petersen
2025-09-16test: remove test-compare-output and test-asm-link testsAlex Rønne Petersen
These were low value and unfocused tests. We already have coverage of the important aspects of these tests elsewhere. Additionally, there was really no need for these to have their own test harness.
2025-09-16std.crypto: add AES-SIV and AES-GCM-SIVFrank Denis
The Zig standard library lacked schemes that resist nonce reuse. AES-SIV and AES-GCM-SIV are the standard options for this. AES-GCM-SIV can be very useful when Zig is used to target embedded systems, and AES-SIV is especially useful for key wrapping. Also take it as an opportunity to add a bunch of test vectors to modes.ctr and make sure it works with block ciphers whose size is not 16.
2025-09-15bpf: use bitCast instead of intCast in ld_imm_implGeorge Huebner
Any 32 bit immediate is allowed in a BPF instruction, including those greater than the largest positive i32 value.
2025-09-15frontend: fix reference tracking through coerced function bodiesmlugg
This bug was manifesting for user as a nasty link error because they were calling their application's main entry point as a coerced function, which essentially broke reference tracking for the entire ZCU, causing exported symbols to silently not get exported. I've been a little unsure about how coerced functions should interact with the unit graph before, but the solution is actually really obvious now: they shouldn't! `Sema` is now responsible for unwrapping possibly-coerced functions *before* queuing analysis or marking unit references. This makes the reference graph optimal (there are no redundant edges representing coerced versions of the same function) and simplifies logic elsewhere at the expense of just a few lines in Sema.
2025-09-15std.net.Ip6Address: format numerical scope iddatabase64128
2025-09-13std.math.big.int: normalize zero result for small multiplicationsmlugg
Resolves: #25221
2025-09-13std.os.linux.ptrace: add PTRACE_EVENT_* and PTRACE_O_* valuesJustus Klausecker
2025-09-13std.posix.ptrace: support more platforms more correctlyJustus Klausecker
2025-09-12linux: Doc and check retval for no-fail pid callsBrandon Black
The switch from @bitCast() to @intCast() here safety-checks Linux's assertion that these 3 calls never return errors (negative values as pid_t). getppid() can legally return 0 if the parent is in a different pid namespace, but this is not an error.
2025-09-12std.os.linux.setsid(): return raw syscall0 resultBrandon Black
When not linking libc on 64-bit Linux and calling posix.setsid(), we get a type error at compile time inside of posix.errno(). This is because posix.errno()'s non-libc branch expects a usize-sized value, which is what all the error-returning os.linux syscalls return, and linux.setsid() instead returned a pid_t, which is only 32 bits wide. This and the other 3 pid-related calls just below it (getpid(), getppid(), and gettid()) are the only Linux syscall examples here that are casting their return values to pid_t. For the other 3 this makes sense: those calls are documented to have no possible errors and always return a valid pid_t value. However, setsid() actually can return the error EPERM, and therefore needs to return the raw value from syscall0 for posix.errno() to process like normal. Additionally, posix.setsid() needs an @intCast(rc) for the success case as a result, like most other such cases.
2025-09-12std.os.linux.socketpair(): switch to unsigned argsBrandon Black
We need std.os.linux and std.c to agree on the types here, or else we'd have to pointlessly cast across the difference up in the std.posix wrapper. I ran into this as a type error the first time I tried to compile my code that calls posix.socketpair() on Linux without libc. All of our existing socket calls with these kinds of arguments in std (including the existing c.socketpair as well as os.linux.socket in this same file) use unsigned for all of these parameters, and so this brings linux.socketpair() into alignment with everything else.
2025-09-11compiler-rt: export __aeabi_read_tp for arm-freebsdAlex Rønne Petersen
FreeBSD normally provides this symbol in libc, but it's in the FBSDprivate_1.0 namespace, so it doesn't get included in our abilists file. Fortunately, the implementation is identical for Linux and FreeBSD, so we can just provide it in compiler-rt. It's interesting to note that the same is not true for NetBSD where the implementation is more complex to support older Arm versions. But we do include the symbol in our abilists file for NetBSD libc, so that's fine. closes #25215
2025-09-11Fix standalone test simple/cat/main.zig after Writergate update (#25188)Sardorbek Imomaliev
* Make cat in test/standalone/simple working again - Fixes: zig/0.15.1/lib/zig/std/Io/Writer.zig:939:11: 0x1049aef63 in sendFileAll (nclip) assert(w.buffer.len > 0); - because we are no using non zero buffers for stdout - "do not forget to flush" * replace std.fs with fs because we are already importing it
2025-09-11use pointer subtractionmarko
2025-09-10x86_64: fix `@splat` typoJacob Young
2025-09-10x86_64: delete usages of avx2 `vpack?s??`Jacob Young
This instruction actually has fairly useless semantics, and even the cases that were semantically correct could save 1 cycle of latency by using a different sequnce involving the avx version instead. Closes #25174
2025-09-10x86_64: fix strictness edge cases in `+|`Jacob Young
Closes #25145
2025-09-10Merge pull request #24968 from ifreund/dequeAndrew Kelley
std: add a Deque data structure
2025-09-10README: update llvm requirement to 21Tea
2025-09-09standalone posix tests for sigactionPat Tullmann
Fixes #24380
2025-09-09standalone posix tests for relative path linkingPat Tullmann
2025-09-09standalone posix test for env varsPat Tullmann
2025-09-09standalone posix test for current working directoryPat Tullmann
2025-09-09standalone posix tests: add skeletonPat Tullmann
Add build.zig, README and empty test files.
2025-09-09posix/test.zig: "sigset_t bits" test fixesPat Tullmann
Re-enable the test. Will trigger #24380 as-is, but follow-on change moes this code over to test/standalone. Make the test a bit easier to debug by stashing the "seen" signal number in the shared `seen_sig` (instead of just incrementing a counter for each hit). And only doing so if the `seen_sig` is zero.
2025-09-09Move some Thread tests out of posix/test.zig into Thread.zigPat Tullmann
These tests aren't (directly) using Posix APIs, so they don't need to be in posix/test.zig. Put them over with the code and tests in Thread.zig. Since the spawn/join test in the posix code was redundant, just dropped that one.
2025-09-10langref: added missing newlines to destructuring tuples exampleLukaTD
langref: added missing newlines to destructuring tuples example
2025-09-09std: add IP, IPV6, IPTOS sockopt constantsBrandon Black
Because these lists are very long in several cases and quite varied, I opted to place them in the existing c/foo.zig files. There are many other sets of network-related constants like this to add over time across all the OSes. For now I picked these because I needed a few constants from each of these namespaces for my own project, so I tried to flesh out these namespaces completely as best I could, at least for basic sockopt purposes. Note windows has some of these already defined in ws2_32 as individual constants rather than contained in a namespacing struct. I'm not sure what to do with that in the long run (break it and namespace them?), but this doesn't change the status quo for windows in any case.
2025-09-09std: add linger struct for SO.LINGERBrandon Black
2025-09-09std: add in_pktinfo and in6_pktinfo structs defsBrandon Black
in_pktinfo is only used on a few targets for the IP_PKTINFO sockopt, as many BSDs use an alternate mechanism (IP_RECVDSTADDR) that doesn't require a special struct. in6_pktinfo is more universal.
2025-09-09std.c: Add accept_filter_arg for some BSDsBrandon Black
This is the struct type used as set/getsockopt() option data with SO.ACCEPTFILTER, which is also only declared on this same limited set of BSD-ish targets. In theory this could be aliased over to std.posix as well, but I think for a corner case like this, it's not unreasonable for a user that is avoiding uneccessary std.c references to access it as "posix.system.accept_filter_arg" (which would still work fine if, in the future, FreeBSD escapes its libc dep and defines it in std.os.freebsd).
2025-09-09std: Add SCM constants for socket control messagesBrandon Black