Commit graph

7763 commits

Author SHA1 Message Date
Jackson Wambolt
eb1a4970da
Sema: check min/max operand types 2025-07-30 20:48:38 +00:00
Matthew Lugg
389ccf692a
Merge pull request #24278 from gooncreeper/atomic-fixes
atomic fixes and clarification
2025-07-30 21:30:29 +01:00
Krzysztof Wolicki
3d639481d9
Sema: disallow tags on non-auto unions when reifying (#23488) 2025-07-30 18:18:49 +00:00
Justus Klausecker
6ec275ebd8 Sema: remove incorrect safety check for saturating left shift 2025-07-30 10:15:48 +01:00
Kendall Condon
b0d6c227d3 Sema: catch error sets in atomic operations
also fix the struct test
2025-07-30 09:56:38 +01:00
Kendall Condon
f7dc9b50ab llvm: fix atomic widening of packed structs
Additionally, disable failing big-endian atomic test

also improve test paramaters to catch this when condition is removed

also some other cleanups
2025-07-30 09:56:38 +01:00
mlugg
08f1d63be1
disable more failing tests
Wow, *lots* of backends were reliant on Sema doing the heavy lifting for
them. CBE, Wasm, and SPIR-V have all regressed in places now that they
actually need to, like, initialize unions and such.
2025-07-29 22:44:01 +01:00
mlugg
a8888afcc0
Sema: remove redundant comptime-known initializer tracking
This logic predates certain Sema enhancements whose behavior it
essentially tries to emulate in one specific case in a problematic way.
In particular, this logic handled initializing comptime-known `const`s
through RLS, which was reworked a few years back in 644041b to not rely
on this logic, and catching runtime fields in comptime-only
initializers, which has since been *correctly* fixed with better checks
in `Sema.storePtr2`. That made the highly complex logic in
`validateStructInit`, `validateUnionInit`, and `zirValidatePtrArrayInit`
entirely redundant. Worse, it was also causing some tracked bugs, as
well as a bug which I have identified and fixed in this PR (a
corresponding behavior test is added).

This commit simplifies union initialization by bringing the runtime
logic more in line with the comptime logic: the tag is now always
populated by `Sema.unionFieldPtr` based on `initializing`, where this
previously happened only in the comptime case (with `validateUnionInit`
instead handling it in the runtime case). Notably, this means that
backends are now able to consider getting a pointer to an inactive union
field as Illegal Behavior, because the `set_union_tag` instruction now
appears *before* the `struct_field_ptr` instruction as you would
probably expect it to.

Resolves: #24520
Resolves: #24595
2025-07-29 15:52:19 +01:00
Jacob Young
3fbdd58a87 aarch64: implement scalar @mod 2025-07-28 22:23:19 -07:00
Jacob Young
c334956a54 aarch64: workaround some optional/union issues 2025-07-28 09:03:17 -07:00
Ivan
dea3ed7f59
build: fix error in standalone test when using --release
Co-authored-by: Carl Åstholm <carl@astholm.se>
2025-07-28 08:10:23 +01:00
Jacob Young
b26e732bd0 aarch64: fix error union constants 2025-07-27 08:01:07 -04:00
Jacob Young
771523c675 aarch64: implement var args 2025-07-27 06:59:38 -04:00
Andrew Kelley
da408bd6fc
Merge pull request #24585 from jacobly0/aarch64
aarch64: more progress
2025-07-27 00:17:19 -07:00
Andrew Kelley
de39c5f67f
Merge pull request #24587 from jacobly0/x86_64
x86_64: fix some bugs
2025-07-26 18:41:29 -07:00
Jacob Young
7894703ee7 aarch64: implement more optional/error union/union support 2025-07-26 21:39:50 -04:00
Jacob Young
69abc945e4 aarch64: implement some safety checks
Closes #24553
2025-07-26 17:31:04 -04:00
Jacob Young
7c349da49c aarch64: implement complex switch prongs 2025-07-26 16:08:40 -04:00
Matthew Lugg
a51cdf3b24
Merge pull request #22587 from castholm/deprecate-compile-apis
std.Build: Deprecate `Step.Compile` APIs that mutate the root module
2025-07-26 18:03:33 +01:00
mlugg
c9ce1debe7 Sema: exclude sentinel from source array length in pointer cast to slice
Resolves: #24569
2025-07-26 14:54:04 +01:00
Jacob Young
68cfa736df x86_64: fix switch on mod result
Closes #24541
2025-07-26 06:24:03 -04:00
Carl Åstholm
154bd2fd05 Migrate from deprecated Step.Compile APIs 2025-07-26 12:06:43 +02:00
Andrew Kelley
9e11727c7c
Merge pull request #23340 from castholm/pass-null-to-b-dependency
Add support for passing null, string literals, enum lists and more to `b.dependency()`
2025-07-25 18:00:46 -07:00
Jacob Young
869ef00602 aarch64: more progress
- factor out `loadReg`
 - support all general system control registers in inline asm
 - fix asserts after iterating field offsets
 - fix typo in `slice_elem_val`
 - fix translation of argument locations
2025-07-25 14:20:23 -04:00
mlugg
bb71a18ede init: replace '--strip' with '--minimal'
This option never worked properly (it emitted wrongly-formatted code),
and it doesn't seem particularly *useful* -- someone who's proficient
enough with `std.Build` to not need explanations probably just wants to
write their own thing. Meanwhile, the use case of writing your own
`build.zig` was extremely poorly served, because `build.zig.zon` *needs*
to be generated programmatically for a correct `fingerprint`, but the
only ways to do that were to a) do it wrong and get an error, or b) get
the full init template and delete the vast majority of it. Both of these
were pretty clunky, and `-s` didn't really help.

So, replace this flag with a new one, `--minimal`/`-m`, which uses a
different template. This template is trivial enough that I opted to just
hardcode it into the compiler for simplicity. The main job of
`zig init -m` is to generate a correct `build.zig.zon` (if it is unable
to do this, it exits with a fatal error). In addition, it will *attempt*
to generate a tiny stub `build.zig`, with only an `std` import and an
empty `pub fn build`. However, if `build.zig` already exists, it will
avoid overwriting it, and doesn't even complain. This serves the use
case of writing `build.zig` manually and *then* running `zig init -m`
to generate an appropriate `build.zig.zon`.
2025-07-25 16:24:02 +01:00
Pavel Verigo
4328f71d9f Revert "disable -fno-llvm -target wasm32-wasi testing"
This reverts commit 83960e0eb0.
2025-07-24 01:18:08 +02:00
Pavel Verigo
fcd9f521d2 stage2-wasm: implement try_ptr + is_(non_)err_ptr 2025-07-24 01:18:02 +02:00
Andrew Kelley
2365392e0e
Merge pull request #24536 from jacobly0/aarch64
aarch64: add new from scratch self-hosted backend
2025-07-23 09:18:50 +02:00
Alex Rønne Petersen
5c576573bb test: enable arm-freebsd-eabihf std tests
Closes #23949.
2025-07-23 05:23:42 +02:00
Jacob Young
5060ab99c9 aarch64: add new from scratch self-hosted backend 2025-07-22 19:43:47 -07:00
Matthew Lugg
687370237f llvm: fix switch loop on larger than pointer integer 2025-07-22 14:50:22 -04:00
Andrew Kelley
38559e282b disable failing test
tracked by #24524
2025-07-21 12:32:37 -07:00
Andrew Kelley
f1576ef14c objcopy: delete most of it
this code is not up to zig project standards

tracked by #24522

oh, and fix not adjusting buffer seek position in std.fs.File.Reader
2025-07-21 12:32:37 -07:00
Carl Åstholm
ca57115da7 Support passing std.zig.BuildId to b.dependency() 2025-07-20 18:28:36 +02:00
Carl Åstholm
2c1a349fb9 Support passing enum slices to b.dependency() 2025-07-20 18:28:36 +02:00
Carl Åstholm
fd5eba9358 Coerce slice-like arguments passed to b.dependency()
You can now pass string literals as options.
2025-07-20 18:28:36 +02:00
Carl Åstholm
5380e81924 Support passing null to b.dependency()
Both null literals and optionals are supported.
2025-07-20 18:28:36 +02:00
Carl Åstholm
00bc72b5ff Add standalone test case for passing options to dependencies 2025-07-20 18:28:36 +02:00
Carl Åstholm
b92b55ab8e Update test build.zig.zon files to conform to the new manifest rules 2025-07-20 18:28:36 +02:00
Andrew Kelley
83960e0eb0 disable -fno-llvm -target wasm32-wasi testing
no active maintainer, and it's failing to lower some basic stuff
2025-07-19 19:57:37 -07:00
mlugg
67e6df4313 tests: remove more old async tests
The rejection of #6025 indicates that if stackless coroutines return to
Zig, they will look quite different; see #23446 for the working draft
proposal for their return (though it will definitely be tweaked before
being accepted). Some of this test coverage was deleted in 40d11cc, but
because stackless coroutines will take on a new form if re-introduced, I
anticipate that essentially *none* of this coverage will be relevant. Of
course, if it for some reason is, we can always grab it from the Git
history.
2025-07-19 08:52:13 +02:00
Felix Koppe
3ae0ba096d
test: Restore and fix deleted tests that relied on intern pool types (#24422) 2025-07-17 22:07:50 +00:00
Andrew Kelley
76d04c1662 zig fmt 2025-07-16 10:27:39 -07:00
Alex Rønne Petersen
6002514b72
test: mark riscv soft float targets as extra targets
Soft float is a very rare use case for riscv*-linux. No point wasting CI
resources on these targets, especially since our arm and mips soft float
coverage is already likely to catch most soft float bugs.
2025-07-16 16:54:12 +02:00
Alex Rønne Petersen
11a49868a1
test: actually build the tools! 2025-07-16 06:38:53 +02:00
dweiller
94e0c85b6b update dump-cov for alignment and writergate changes 2025-07-15 23:57:56 +02:00
Andrew Kelley
0cb558ba3a better default min versions for freebsd and netbsd
Without this change, by default you get a failure when trying to cross
compile for these targets.

freebsd was error: undefined symbol: __libc_start1
netbsd was warning: invalid target NetBSD libc version: 9.4.0
error: unable to build NetBSD libc shared objects: InvalidTargetLibCVersion

now they work by default
2025-07-15 15:32:18 +02:00
Andrew Kelley
b993728f10 make it a behavior test instead
It's important to check for correct runtime behavior, rather than only
checking that the compiler does not crash.
2025-07-14 10:02:37 -07:00
Justus Klausecker
29ac68b253 Sema: Fix invalid AIR generation for switch loop with comptime discarded tag
Add an additional check before emitting `.loop_switch_br` instead
of `.switch_br` in a tagged switch statement for whether any of the
continues referencing its tag are actually runtime reachable.
This fixes triggering an assertion in Liveness caused by the invalid
assumption that every tagged switch must be a loop if its tag is
referenced in any way even if this reference is not runtime reachable.
2025-07-14 09:59:13 -07:00
Alex Rønne Petersen
f4ed35f800 test: disable non-native loongarch64 behavior and std tests
https://github.com/ziglang/zig/issues/24405
2025-07-11 21:31:27 +02:00