Commit graph

7724 commits

Author SHA1 Message Date
Jacob Young
bc10131db1 x86_64: rewrite scalar @mulWithOverflow
Closes #19607
2025-04-09 20:14:12 -04:00
Jacob Young
55ce756868 x86_64: rewrite scalar @subWithOverflow 2025-04-09 20:14:12 -04:00
Jacob Young
80068b6e59 x86_64: rewrite scalar @addWithOverflow 2025-04-09 20:14:12 -04:00
Jacob Young
426684b2f8 behavior: fix issues with x86_64 backend tests
* Oops, I accidentally disabled most of them.
 * Cleanup some workarounds for now closed issues.
 * Test binary operations with more scalar integer types.
2025-04-09 20:14:12 -04:00
imreallybadatnames™️
7733b5dbe6
Merge pull request #23501 from imreallybadatnames/master
Step.Compile: use LtoMode enum for lto option
2025-04-09 05:16:36 +00:00
Alex Rønne Petersen
9bbac42886
Merge pull request #23478 from alexrp/bsd-versions
`std.Target`: Bump some minimum OS versions for BSDs
2025-04-08 18:27:39 +02:00
Alex Rønne Petersen
d8153fa74a
Merge pull request #23495 from alexrp/loongarch
Some `loongarch64-linux` porting work
2025-04-08 01:02:24 +02:00
Matthew Roush
fb1d4990cb
Make translate-c more robust in handling macro functions.
Translate-c didn't properly account for C macro functions having parameter names that are C keywords. So something like `#define FOO(float) ((float) + 10)` would've been interpreted as casting `+10` to a `float` type, instead of adding `10` to the parameter `float`.

An example of a real-world macro function like this is SDL3's `SDL_DEFINE_AUDIO_FORMAT` from `SDL_audio.h`, which uses `signed` as a parameter.
2025-04-07 20:53:38 +00:00
Alex Rønne Petersen
f8439805d7
test: Add loongarch64-linux-(none,musl,gnu) to the test matrix.
Currently skips std tests which have many issues.
2025-04-07 16:03:22 +02:00
Alex Rønne Petersen
6880d2c4a3
test: Disable @prefetch behavior test for loongarch.
https://github.com/llvm/llvm-project/issues/134624
2025-04-07 16:03:22 +02:00
Alex Rønne Petersen
b22d53a5e7
test: Remove some dead FreeBSD targets from llvm_targets.
These were dropped in FreeBSD 12.x, and we now require 13.4+.
2025-04-06 08:05:07 +02:00
Jacob Young
470e2b63d9 Dwarf: handle undefined type values
Closes #23461
2025-04-05 21:42:33 -04:00
Jacob Young
9827ffe1de x86_64: fix incorrect handling of unreusable operands
Closes #23448
2025-04-05 20:49:56 -04:00
Alex Rønne Petersen
7c85dc4602
test: Disable error union switch with call operand (ReleaseSafe) on macos.
This started failing in LLVM 20:

test
+- test-stack-traces
   +- check error union switch with call operand (ReleaseSafe llvm) failure
error:
========= expected this stdout: =========
error: TheSkyIsFalling
source.zig:3:5: [address] in [function]
    return error.TheSkyIsFalling;
    ^

========= but found: ====================
error: TheSkyIsFalling
source.zig:13:27: [address] in [function]
        error.NonFatal => return,
                          ^
2025-04-04 06:08:10 +02:00
Alex Rønne Petersen
7c5412c7a4
build: Rename -Dtest-slow-targets to -Dtest-extra-targets.
This can be used more broadly for targets that aren't quite ready to be tested
by default yet.
2025-04-04 06:08:10 +02:00
Alex Rønne Petersen
96fe4fb969
Revert "test: Partially disable vector float operators on mips."
This reverts commit 19a91084c2.

Closes #21051.
2025-04-04 06:08:10 +02:00
Alex Rønne Petersen
b9456d64d7
test: mips32 is no longer a slow target with LLVM 20.
We can now run these tests as part of test-modules w/o -Dtest-slow-targets.

Closes #21096.
2025-04-04 06:08:10 +02:00
Alex Rønne Petersen
cf9c6f5298
compiler: Update max int alignments for some targets. 2025-04-04 06:08:10 +02:00
Alex Rønne Petersen
8954e9748a
std.Target: Add Abi.muslf32 and Abi.muslsf. 2025-04-04 06:08:09 +02:00
Alex Rønne Petersen
8ea2e1ded5
compiler: Updates for LLVM/Clang 20 API changes. 2025-04-04 06:08:09 +02:00
Parker Liu
de62dc884e
translate-c: fix function prototype decalared inside a function
* If a function prototype is declarated inside a function, do not
  translate it to a top-level extern function declaration. Similar to
  extern local variable, just wrapped it into a block-local struct.

* Add a new extern_local_fn tag of aro_translate_c node for present
  extern local function declaration.

* When a function body has a C function prototype declaration, it adds
  an extern local function declaration. Subsequent function references
  will look for this function declaration.
2025-04-02 20:07:41 +00:00
mlugg
dd3f01eadf
incremental: add test for ZON file without result type 2025-04-02 05:58:29 +01:00
Mason Remaley
06ee383da9
compiler: allow @import of ZON without a result type
In particular, this allows importing `build.zig.zon` at comptime.
2025-04-02 05:53:22 +01:00
David Rubin
1b62a22268 Sema: increment extra index even if return type is generic 2025-04-02 01:34:17 +02:00
Jacob Young
b431e9af97 Elf: fix incrementally reallocating the last atom in a section 2025-03-31 19:06:25 -04:00
mlugg
d53cc5e5b2 Sema: allow @ptrCast slice of zero-bit type to slice of non-zero-bit type
This is actually completely well-defined. The resulting slice always has
0 elements. The only disallowed case is casting *to* a slice of a
zero-bit type, because in that case, you cna't figure out how many
destination elements to use (and there's *no* valid destination length
if the source slice corresponds to more than 0 bits).
2025-03-31 19:03:08 -04:00
Parker Liu
0bdc0bb534
translate-c: fix referencing extern locals from nested blocks 2025-03-31 20:22:03 +03:00
David Rubin
acfdad8581 Sema: convert slice sentinel to single pointer correctly 2025-03-30 03:41:00 +01:00
mlugg
f296eec294 Zcu: resolve layout of analyzed declaration type
Resolves: #19888
2025-03-29 22:46:31 +00:00
mlugg
eee752ea5a compiler: "illegal behavior", not "undefined behavior", in errors 2025-03-29 18:40:23 -04:00
GalaxyShard
b5a5260546 std.Build: implement addEmbedPath for adding C #embed search directories 2025-03-27 09:47:42 +01:00
Ryan Liptak
63014d3819 Add test to ensure the BatBadBut mitigation handles trailing . and space safely
Context:
- https://blog.rust-lang.org/2024/09/04/cve-2024-43402.html
- https://github.com/rust-lang/rust/pull/129962

Note that the Rust test case for this checks that it executes the batch file successfully with the proper mitigation in place, while the Zig test case expects a FileNotFound error. This is because of a PATHEXT optimization that Zig does, and that Rust doesn't do because Rust doesn't do PATHEXT appending (it only appends .exe specifically). See the added comment for more details.
2025-03-26 10:55:18 +01:00
Jonathan Marler
1408288b95 support more process creation options on Windows
Adds a CreateProcessFlags packed struct for all the possible flags to
CreateProcessW on windows.  In addition, propagates the existing
`start_suspended` option in std.process.Child which was previously only
used on Darwin.  Also adds a `create_no_window` option to std.process.Child
which is a commonly used flag for launching console executables on
windows without causing a new console window to "pop up".
2025-03-25 23:48:27 +01:00
Alex Rønne Petersen
cb8d7a8110
Merge pull request #23310 from Rexicon226/fix-23309
big.int: return normalized results from `{add,sub}Carry`
2025-03-25 18:44:35 +01:00
David Rubin
89db4f2e93 Sema: use unwrapped generic owner in getFuncInstanceIes 2025-03-24 19:04:10 +00:00
Pavel Verigo
33ad2c949e stage2-wasm: packed store/load 128 bits 2025-03-24 15:00:00 +01:00
Pavel Verigo
47cd0961cb stage2-wasm: pass field_parent_ptr tests
Handle packed containers, also fixes packed union lowering for non int type + union field pointer logic fix
2025-03-24 15:00:00 +01:00
Pavel Verigo
58b38238f5 stage2-wasm: enable undef test + ignore undef store/memset with safety off 2025-03-24 15:00:00 +01:00
Pavel Verigo
07f14bd43b stage2-wasm: fix error union handling 2025-03-24 15:00:00 +01:00
Pavel Verigo
0e109add37 stage2-wasm: clean memcpy + fix another bug in aggr_init for optionals arr 2025-03-24 15:00:00 +01:00
Pavel Verigo
15bc2ab0a8 stage2-wasm: clz fix 2025-03-24 15:00:00 +01:00
Pavel Verigo
a429d04ba9 stage2-wasm: enable already working tests 2025-03-24 14:59:58 +01:00
Pavel Verigo
ca2bd6d6ef stage2-wasm: fix comparing and storing optionals 2025-03-24 14:58:05 +01:00
David Rubin
22013f1b39
test: add a behavior test for 0-length loop fix 2025-03-24 06:58:01 -07:00
mlugg
26fdb81c16 Sema: fix in-memory coercion of functions introducing new generic parameters
While it is not allowed for a function coercion to change whether a
function is generic, it *is* okay to make existing concrete parameters
of a generic function also generic, or vice versa. Either of these cases
implies that the result is a generic function, so comptime type checks
will happen when the function is ultimately called.

Resolves: #21099
2025-03-24 04:32:45 +00:00
Jacob Young
98640cbeb8
Merge pull request #23209 from jacobly0/x86_64-rewrite
x86_64: rewrite wrapping multiplication
2025-03-23 21:56:58 -04:00
Jacob Young
f7e045c806 Merge pull request #23256 from xtexx/fix-gh-20113
x86_64: fix packedStore miscomp by spilling EFLAGS
2025-03-23 21:46:46 -04:00
Jacob Young
6705cbd5eb codegen: fix packed byte-aligned relocations
Closes #23131
2025-03-23 18:35:34 -04:00
Ryan Liptak
752e7c0fd0 Add standalone test for environment variables
Tests all environment variable APIs in std.process
2025-03-22 15:44:27 -07:00
Bingwu Zhang
a26f1768d8
x86_64: add behavior test for packed store 2025-03-22 16:36:14 +08:00