34907 Commits

Author SHA1 Message Date
Andrew Kelley
2ba03e98c8 disable failing stage2_aarch64 behavior tests 2025-09-20 18:33:01 -07:00
Andrew Kelley
5d8c1fb6ab frontend: another packedStructFieldPtrInfo fix
it was calculating host integer size in a wrong way. just use integer
abi size
2025-09-20 18:33:01 -07:00
mlugg
baaf715d21 cases: update for new error
The latest bugfix reverted this case to its old behavior (which is a
reasonable behavior to have).
2025-09-20 18:33:01 -07:00
mlugg
fcc7e378f8 Revert "delete failing test case"
This reverts commit ba4d4602ab9bb0dc17fc0d57141d9324bdbb356d.
2025-09-20 18:33:01 -07:00
mlugg
2f9d8d5a9b Zcu: fix analysis of type of decl with inferred type
If the `nav_ty` is resolved by the `nav_val`, then we need to also mark
the `nav_ty` as in progress when we begin resolving the `nav_val`.
2025-09-20 18:33:01 -07:00
Andrew Kelley
d7d50496d9 langref: don't assume too much about pointer to packed struct field 2025-09-20 18:33:01 -07:00
Andrew Kelley
725dec6aa7 Sema: add missed logic to checkPtrAttributes
It wasn't checking bit pointer data.
2025-09-20 18:33:01 -07:00
Andrew Kelley
7ffe068a79 delete failing test case
Matthew can revert this commit when he's ready to tackle the assertion
failure
2025-09-20 18:33:01 -07:00
Jacob Young
cbbb67c5df x86_64: fix safety crashes in storeRegs 2025-09-20 18:33:01 -07:00
Andrew Kelley
0681bf06ab frontend: packed struct field ptr no longer finds byte borders
technically breaking, but I doubt anyone will notice.
2025-09-20 18:33:01 -07:00
Andrew Kelley
e1a750655e disable wasm backend coverage
Disabled due to no active maintainer (feel free to fix the failures and
then re-enable at any time). The failures occur due to backend
miscompilation of different AIR from the frontend.
2025-09-20 18:33:01 -07:00
Andrew Kelley
c369def08e disable spirv64-vulkan coverage
Disabled due to no active maintainer (feel free to fix the failures and
then re-enable at any time). The failures occur due to changing AIR from
the frontend, and backend being incomplete.
2025-09-20 18:33:00 -07:00
Andrew Kelley
c0bbddb007 Sema: avoid ptr_add/ptr_sub instructions void elem type 2025-09-20 18:33:00 -07:00
Andrew Kelley
aacff8c800 add compile error coverage for dependency loop 2025-09-20 18:33:00 -07:00
Andrew Kelley
7b8a7989ef frontend: additionally handle C pointers in ptrOptPayload 2025-09-20 18:33:00 -07:00
Jacob Young
2fdf0e29b3 aarch64: enable fixed behavior 2025-09-20 18:33:00 -07:00
Andrew Kelley
e5adfd87bc translate-c: remove cases associated with runtime vector indexing
C translation is in the process of switching to be aro-based
(see #24497)

That codebase will need to gain some kind of helper for translating C
code that uses runtime vector indexing.
2025-09-20 18:33:00 -07:00
Andrew Kelley
f0fe55a9bb frontend: fix too strict assertion
field ptr can be based on C pointer
2025-09-20 18:33:00 -07:00
Jacob Young
f12c4f86fc aarch64: implement ptr_slice_*_ptr 2025-09-20 18:33:00 -07:00
Andrew Kelley
5ec0a7d8a5 coerce vectors to arrays rather than inline for 2025-09-20 18:33:00 -07:00
Andrew Kelley
9b74651cd2 Sema: fix YAGNI violation 2025-09-20 18:33:00 -07:00
Andrew Kelley
4fef90fa92 Sema: more conservative elem_ptr_load implementation
like field_ptr_load, this now does byval operations when the lhs is
comptime-known.
2025-09-20 18:33:00 -07:00
Andrew Kelley
9afa6835df frontend: replace elem_val_node with elem_ptr_load
avoids unnecessary copies
2025-09-20 18:33:00 -07:00
Andrew Kelley
95439c9820 std.Progress: avoid problematic catch syntax 2025-09-20 18:33:00 -07:00
Andrew Kelley
354c17869a frontend: replace field_val and field_val_named
with field_ptr_load and field_ptr_named_load.

These avoid doing by-val load operations for structs that are
runtime-known while keeping the previous semantics for comptime-known
values.
2025-09-20 18:33:00 -07:00
Andrew Kelley
3bd62e1bb6 Sema: fix source location of "declared here" note
point at the var not at the init expression
2025-09-20 18:33:00 -07:00
Andrew Kelley
d00aee021b x86 codegen: handle spilled tuples 2025-09-20 18:33:00 -07:00
Andrew Kelley
09e4fc4dcf std.zon.parse: fix not initializing array sentinel 2025-09-20 18:33:00 -07:00
Andrew Kelley
772793c004 Sema: fix accessing ptr field of double array pointer with sentinel 2025-09-20 18:33:00 -07:00
Andrew Kelley
426af68b7d compiler: require comptime vector indexes 2025-09-20 18:33:00 -07:00
Andrew Kelley
14bda4130a llvm backend: remove canElideLoad mechanism 2025-09-20 18:33:00 -07:00
Ryan Liptak
3fbb88c4bd Reader.defaultReadVec: Workaround bad r.end += r.vtable.stream() behavior
If `r.end` is updated in the `stream` implementation, then it's possible that `r.end += ...` will behave unexpectedly. What seems to happen is that it reverts back to its value before the function call and then the increment happens. Here's a reproduction:

```zig
test "fill when stream modifies `end` and returns 0" {
    var buf: [3]u8 = undefined;
    var zero_reader = infiniteZeroes(&buf);

    _ = try zero_reader.fill(1);
    try std.testing.expectEqual(buf.len, zero_reader.end);
}

pub fn infiniteZeroes(buf: []u8) std.Io.Reader {
    return .{
        .vtable = &.{
            .stream = stream,
        },
        .buffer = buf,
        .end = 0,
        .seek = 0,
    };
}

fn stream(r: *std.Io.Reader, _: *std.Io.Writer, _: std.Io.Limit) std.Io.Reader.StreamError!usize {
    @memset(r.buffer[r.seek..], 0);
    r.end = r.buffer.len;
    return 0;
}
```

When `fill` is called, it will call into `vtable.readVec` which in this case is `defaultReadVec`. In `defaultReadVec`:

- Before the `r.end += r.vtable.stream` line, `r.end` will be 0
- In `r.vtable.stream`, `r.end` is modified to 3 and it returns 0
- After the `r.end += r.vtable.stream` line, `r.end` will be 0 instead of the expected 3

Separating the `r.end += stream();` into two lines fixes the problem (and this separation is done elsewhere in `Reader` so it seems possible that this class of bug has been encountered before).

Potentially related issues:

- https://github.com/ziglang/zig/issues/4021
- https://github.com/ziglang/zig/issues/12064
2025-09-20 18:31:38 -07:00
Andrew Kelley
0e47bd16da add behavior test: return undefined pointer from function
This clarifies that it is legal to return an invalid pointer from a
function, provided that such pointer is not dereferenced.

This matches current status quo of the language. Any change to this
should be a proposal that argues for different semantics.

It is also legal in C to return a pointer to a local. The C backend
lowers such thing directly, so the corresponding warning in C must be
disabled (`-Wno-return-stack-address`).
2025-09-20 17:49:00 -07:00
Andrew Kelley
4d1b15bd9d
Merge pull request #25298 from ziglang/SegmentedList-orphaned-again
std: delete SegmentedList again
2025-09-20 10:29:02 -07:00
John Benediktsson
14fc4d4811 std.c: add MSG support for dragonfly 2025-09-20 19:21:14 +02:00
Alex Rønne Petersen
7857bbd116 std.crypto.ascon: disable Ascon-AEAD128 test on RISC-V with V support 2025-09-20 19:05:32 +02:00
John Benediktsson
1ac4c27d74 std.c: adjust shm_open to be variadic on darwin 2025-09-20 07:33:50 +02:00
Justus Klausecker
be571f32c3 std.Build.Step.Run: Enable passing (generated) file content as args
Adds `addFileContentArg` and `addPrefixedFileContentArg` to pass the content
of a file with a lazy path as an argument to a `std.Build.Step.Run`.
This enables replicating shell `$()` / cmake `execute_process` with `OUTPUT_VARIABLE`
as an input to another `execute_process` in conjuction with `captureStdOut`/`captureStdErr`.

To also be able to replicate `$()` automatically trimming trailing newlines and cmake
`OUTPUT_STRIP_TRAILING_WHITESPACE`, this patch adds an `options` arg to those functions
which allows specifying the desired handling of surrounding whitespace.

The `options` arg also allows to specify a custom `basename` for the output. e.g.
to add a file extension (concrete use case: Zig `@import()` requires files to have a
`.zig`/`.zon` extension to recognize them as valid source files).
2025-09-19 17:38:40 -07:00
Andrew Kelley
1eeb8fabe5 std: delete SegmentedList again
The data structure was originally added in
41e1cd185b82a518c58c92544c45f0348c03ef74 and then removed in
50a336fff899ebd8a687c453ec6beb18a5a9baf9, but brought back in
711bf55eaa643c3d05640bebbf3e4315477b8ed8 for Decl in the compiler
frontend, and then the last reference to it was eliminated in
548a087fafeda5b07d2237d5137906b8d07da699 which removed Decl in favor of
Nav and Cau.
2025-09-19 16:40:00 -07:00
Andrew Kelley
4a38d783e8 tools: eliminate dependency on std.SegmentedList 2025-09-19 16:40:00 -07:00
Andrew Kelley
164c598cd8
Merge pull request #23416 from gooncreeper/improved-fuzzer
greatly improve capabilities of the fuzzer
2025-09-19 09:27:25 -07:00
Frank Denis
bc921fec12 Fix duplicate LC_RPATH entries on macOS Tahoe
When building on macOS Tahoe, binaries were getting duplicate LC_RPATH
load commands which caused dyld to refuse to run them with a
"duplicate LC_RPATH" error that has become a hard error.

The duplicates occurred when library directories were being added
to rpath_list twice:

- from lib_directories
- from native system paths detection which includes the same dirs
2025-09-19 16:39:00 +02:00
Alex Rønne Petersen
97df4ae3ce
Merge pull request #25268 from alexrp/loongarch
Miscellaneous LoongArch work to prepare for CI
2025-09-19 12:09:48 +02:00
andrewkraevskii
de489031d8 Remove usages of deprecatedWriter 2025-09-18 22:39:33 -07:00
John Benediktsson
37ecaae639
std.fmt: migrate bufPrintZ to bufPrintSentinel (#25260) 2025-09-19 05:02:22 +00:00
Alex Rønne Petersen
47c932f896 std.simd: suggest more sensible vector sizes across the board 2025-09-19 04:01:08 +02:00
Kendall Condon
7c6ccca46d fuzzer: remove rodata load tracing
This can be re-evaluated at a later time, but at the moment the
performance and stability concerns hold it back. Additionally, it
promotes a non-smithing approach to fuzz tests.
2025-09-18 18:56:18 -04:00
Kendall Condon
b905c65661 add some new fuzz tests 2025-09-18 18:56:18 -04:00
Kendall Condon
e66b269333 greatly improve capabilities of the fuzzer
This PR significantly improves the capabilities of the fuzzer.

The changes made to the fuzzer to accomplish this feat mostly include
tracking memory reads from .rodata to determine fresh inputs, new
mutations (especially the ones that insert const values from .rodata
reads and __sanitizer_conv_const_cmp), and minimizing found inputs.
Additionally, the runs per second has greatly been increased due to
generating smaller inputs and avoiding clearing the 8-bit pc counters.

An additional feature added is that the length of the input file is now
stored and the old input file is rerun upon start.

Other changes made to the fuzzer include more logical initialization,
using one shared file `in` for inputs, creating corpus files with
proper sizes, and using hexadecimal-numbered corpus files for
simplicity.

Furthermore, I added several new fuzz tests to gauge the fuzzer's
efficiency. I also tried to add a test for zstandard decompression,
which it crashed within 60,000 runs (less than a second.)

Bug fixes include:
* Fixed a race conditions when multiple fuzzer processes needed to use
the same coverage file.
* Web interface stats now update even when unique runs is not changing.
* Fixed tokenizer.testPropertiesUpheld to allow stray carriage returns
since they are valid whitespace.
2025-09-18 18:56:10 -04:00
Frank Denis
19943f0f21 zig fmt help: mention that the argument can be a directory
I’ve been typing `zig fmt **/.zig` for a long time, until I discovered
that the argument can actually be a directory.

Mention this feature explicitly in the help message.
2025-09-18 22:15:57 +02:00