33094 Commits

Author SHA1 Message Date
Andrew Kelley
6d1f0eca77 start the 0.14.2 release cycle 2025-05-21 22:47:06 -07:00
Andrew Kelley
d03a147ea0 Release 0.14.1 0.14.1 2025-05-21 22:46:47 -07:00
mlugg
7218218040
build runner: don't incorrectly omit reference traces
It's incorrect to ever set `include_reference_trace` here, because the
compiler has already given or not given reference traces depending on
the `-freference-trace` option propagated to the compiler process by
`std.Build.Step.Compile`.

Perhaps in future we could make the compiler always return the reference
trace when communicating over the compiler protocol; that'd be more
versatile than the current behavior, because the build runner could, for
instance, show a reference trace on-demand without having to even invoke
the compiler. That seems really useful, since the reference trace is
*often* unnecessary noise, but *sometimes* essential. However, we don't
live in that world right now, so passing the option here doesn't make
sense.

Resolves: #23415
2025-05-17 00:36:54 +02:00
mlugg
f377ea1060
doctest: handle relative paths correctly
Evaluate all child processes in the temporary directory, and use
`std.fs.path.relative` to make every other path relative to that child
cwd instead of our cwd.

Resolves: #22119
2025-05-17 00:36:23 +02:00
Marc Tiehuis
455ea58872
std.hash.Wyhash: fix dangling stack pointer
Closes #23895.
2025-05-16 17:03:39 +02:00
Alex Rønne Petersen
925cc08b95
main: List -f(no-)builtin as per-module options.
Contributes to #23424.
2025-05-14 05:44:45 +02:00
Alex Rønne Petersen
90e8af98eb
test: Fix incorrect interpretation of -Dtest-filter=... for test-debugger. 2025-05-14 05:44:32 +02:00
Alex Rønne Petersen
16b331f5fd
Air: Fix mustLower() to consider volatile for a handful of instructions.
These can all potentially operate on volatile pointers.
2025-05-14 05:43:57 +02:00
Alex Rønne Petersen
4bf17f0a78
Air: Always return true for inline assembly in mustLower().
AstGen requires inline assembly to either have outputs or be marked volatile, so
there doesn't appear to be any point in doing these checks.
2025-05-14 05:43:54 +02:00
Alex Rønne Petersen
59f92bff69
Air: Fix mustLower() for atomic_load with inter-thread ordering. 2025-05-14 05:43:28 +02:00
Alex Rønne Petersen
199782edd1
riscv64: Handle writes to the zero register sensibly in result bookkeeping. 2025-05-14 05:43:13 +02:00
Alex Rønne Petersen
bf21e4f725
riscv64: Add missing fence for seq_cst atomic_store. 2025-05-14 05:43:04 +02:00
Cezary Kupaj
c4237e8909
Fix SIGSEGV handler for AArch64 Darwin targets
* ucontext_t ptr is 8-byte aligned instead of 16-byte aligned which @alignCast() expects
* Retrieve pc address from ucontext_t since unwind_state is null
* Work around __mcontext_data being written incorrectly by the kernel
2025-05-14 05:39:01 +02:00
Michael Pfaff
0cb9ffc6d8
Fix implementation of std.os.linux.accept on x86 2025-05-10 10:27:17 +02:00
Alex Rønne Petersen
9070607c03
glibc: Fix stub libraries containing unwanted symbols.
Closes #8096.
2025-05-09 16:44:04 +02:00
mlugg
7199cfc21f
Compilation: don't warn about failure to delete missing C depfile
If clang encountered bad imports, the depfile will not be generated. It
doesn't make sense to warn the user in this case. In fact,
`FileNotFound` is never worth warning about here; it just means that
the file we were deleting to save space isn't there in the first place!
If the missing file actually affected the compilation (e.g. another
process raced to delete it for some reason) we would already error in
the normal code path which reads these files, so we can safely omit the
warning in the `FileNotFound` case always, only warning when the file
might still exist.

To see what this fixes, create the following file...

```c
#include <nonexist>
```

...and run `zig build-obj` on it. Before this commit, you will get a
redundant warning; after this commit, that warning is gone.
2025-05-09 16:43:57 +02:00
Meghan Denny
b1082a31a5
std.os: handle ENOENT for fnctl on macos 2025-05-09 16:43:50 +02:00
xdBronch
55acb29d68
translate-c: fix callconv attribute in macro 2025-05-09 16:43:35 +02:00
HydroH
b21fa8e2cd
std: fix compile errors in std.crypto.ecc (#23797)
Implemented `neg()` method for `AffineCoordinates` struct of p256,
p384 and secp256k1 curves.

Resolves: #20505 (partially)
2025-05-06 18:03:03 +02:00
Alex Rønne Petersen
5cfd47660c
0934823815f1d4336b2160f09f65df5ba8e52a15 take 2. 2025-05-05 09:07:52 +02:00
Alex Rønne Petersen
0934823815
Unbreak the build (156ab8750056c3ff440af0937806d8cdb2623816 is not in the 0.14.x branch). 2025-05-05 08:06:09 +02:00
tjog
e739ba1bd9
disable getauxvalImpl instrumentation as libfuzzer's allocator may need to call it 2025-05-05 07:26:06 +02:00
tjog
f592674642
link+macho+fuzz: use correct input type
A debug build of the compiler detects invalid union access since `classifyInputFile`
detects `.archive` and this line constructed a `.object` input.
2025-05-05 07:25:55 +02:00
Alex Rønne Petersen
566e4ab6b1
compiler: Set libc++ ABI version to 2 for Emscripten.
It remains 1 everywhere else.

Also remove some code that allowed setting the libc++ ABI version on the
Compilation since there are no current plans to actually expose this in the CLI.
2025-05-05 07:25:25 +02:00
Xavier Bouchoux
7b45bd3c09
fix system library lookup when cross-compiling to windows-msvc 2025-05-04 02:52:33 +02:00
Matthew Lugg
e07d8fccd1
Merge pull request #23263 from mlugg/comptime-field-ptr
Sema: fix pointers to comptime fields of comptime-known aggregate pointers
2025-05-04 02:51:47 +02:00
mlugg
db936b9094
compiler: fix comptime memory store bugs
* When storing a zero-bit type, we should short-circuit almost
  immediately. Zero-bit stores do not need to do any work.
* The bit size computation for arrays is incorrect; the `abiSize` will
  already be appropriately aligned, but the logic to do so here
  incorrectly assumes that zero-bit types have an alignment of 0. They
  don't; their alignment is 1.

Resolves: #21202
Resolves: #21508
Resolves: #23307
2025-05-04 02:51:42 +02:00
mlugg
87983e800a
std.Progress: fix many bugs
There were several bugs with the synchronization here; most notably an
ABA problem which was causing #21663. I fixed that and some other
issues, and took the opportunity to get rid of the `.seq_cst` orderings
from this file. I'm at least relatively sure my new orderings are correct.

Co-authored-by: achan1989 <achan1989@gmail.com>
Resolves: #21663
2025-05-04 02:51:07 +02:00
Pat Tullmann
142a890c37
std.os.linux: Fix MIPS signal numbers
Dunno why the MIPS signal numbers are different, or why Zig had them
already special cased, but wrong.

We have the technology to test these constants.  We should use it.
2025-05-02 18:30:50 +02:00
Pavel Verigo
331bd83f11
wasm-c-abi: llvm fix struct handling + reorganize
I changed to `wasm/abi.zig`, this design is certainly better than the previous one. Still there is some conflict of interest between llvm and self-hosted backend, better design will appear when abi tests will be tested with self-hosted.

Resolves: #23304
Resolves: #23305
2025-05-02 18:30:32 +02:00
Alex Rønne Petersen
0209c68fcc
compiler-rt: Add missing _Qp_sqrt export for sparc64.
https://github.com/ziglang/zig/issues/23716
2025-05-01 21:36:19 +02:00
Alex Rønne Petersen
aea1272a3f
test: Disable vector reduce operation for sparc.
https://github.com/ziglang/zig/issues/23719
2025-05-01 21:34:57 +02:00
Alex Rønne Petersen
a09c1d91ed
test: Disable some varargs behavior tests on sparc.
https://github.com/ziglang/zig/issues/23718
2025-05-01 21:34:53 +02:00
Alex Rønne Petersen
47e46b58d2
std.os.linux: Add missing time_t definition for sparc64. 2025-05-01 21:34:49 +02:00
Ali Cheraghi
200fb1e92e
test: skip "struct fields get automatically reordered" for spirv64 backend 2025-05-01 21:34:34 +02:00
psbob
8717453208
Fix Unexpected error for 1453 on Windows (#23729) 2025-05-01 21:31:58 +02:00
Dongjia Zhang
8a5f834240
use correcct symbol for the end of pcguard section 2025-04-28 20:48:30 +02:00
mlugg
bee19572c8
Sema: fix a few indexing bugs
* Indexing zero-bit types should not produce AIR indexing instructions
* Getting a runtime-known element pointer from a many-pointer should
  check that the many-pointer is not comptime-only

Resolves: #23405
2025-04-28 20:48:24 +02:00
dweiller
b5c22777f8
sema: do checked cast when resolving aggregate size 2025-04-28 20:48:19 +02:00
xdBronch
7e68999f79
Sema: fix memcpy with C pointers 2025-04-28 12:10:04 +02:00
Alex Rønne Petersen
470dac8a77
wasi-libc: Fix paths to psignal.c and strsignal.c.
Closes #23709.
2025-04-28 01:03:15 +02:00
Alex Rønne Petersen
e6a71e9e7a
Sema: Fix some ptr alignment checks to handle a potential ISA tag bit.
Closes #23570.
2025-04-28 00:58:53 +02:00
Shun Sakai
168981c678
docs(std.ascii): Remove redundant three slashes 2025-04-28 00:58:44 +02:00
Kevin Primm
23ab05f1f5
compiler: Fix -m<os>-version-min=... ordering 2025-04-27 14:27:52 +02:00
mlugg
160f2dabed
std.Build.Cache: fix several bugs
Aside from adding comments to document the logic in `Cache.Manifest.hit`
better, this commit fixes two serious bugs.

The first, spotted by Andrew, is that when upgrading from a shared to an
exclusive lock on the manifest file, we do not seek it back to the
start. This is a simple fix.

The second is more subtle, and has to do with the computation of file
digests. Broadly speaking, the goal of the main loop in `hit` is to
iterate the files listed in the manifest file, and check if they've
changed, based on stat and a file hash. While doing this, the
`bin_digest` field of `std.Build.Cache.File`, which is initially
`undefined`, is populated for all files, either straight from the
manifest (if the stat matches) or recomputed from the file on-disk. This
file digest is then used to update `man.hash.hasher`, which is building
the final hash used as, for instance, the output directory name when the
compiler emits into the cache directory. When `hit` returns a cache
miss, it is expected that `man.hash.hasher` includes the digests of all
"initial files"; that is, those which have been already added with e.g.
`addFilePath`, but not those which will later be added with
`addFilePost` (even though the manifest file has told us about some such
files). Previously, `hit` was using the `unhit` function to do this in a
few cases. However, this is incorrect, because `hit` assumes that all
files already have their `bin_digest` field populated; this function is
only valid to call *after* `hit` returns. Instead, we need to actually
compute the hashes which haven't yet been populated. Even if this logic
has been working, there was still a bug here, because we called `unhit`
when upgrading from a shared to an exclusive lock, writing the
(potentially `undefined`) file digests, but the loop itself writes the
file digests *again*! All in all, the hashing logic here was actually
incredibly broken.

I've taken the opportunity to restructure this section of the code into
what I think is a more readable format. A new function,
`hitWithCurrentLock`, uses the open manifest file to try and find a
cache hit. It returns a tagged union which, in the miss case, tells the
caller (`hit`) how many files already have their hash populated. This
avoids redundant work recomputing the same hash multiple times in
situations where the lock needs upgrading. This also eliminates the
outer loop from `hit`, which was a little confusing because it iterated
no more than twice!

The bugs fixed here could manifest in several different ways depending
on how contended file locks were satisfied. Most notably, on a cache
miss, the Zig compiler might have written the compilation output to the
incorrect directory (because it incorrectly constructed a hash using
`undefined` or repeated file digests), resulting in all future hits on
this manifest causing `error.FileNotFound`. This is #23110. I have been
able to reproduce #23110 on `master`, and have not been able to after
this commit, so I am relatively sure this commit resolves that issue.

Resolves: #23110
2025-04-27 14:08:21 +02:00
Michael Pfaff
53f298cffa
Calculate WTF-8 length before converting instead of converting into an intermediate buffer on the stack 2025-04-26 15:07:26 +02:00
tjog
3ca0f18bfe
fuzz: fix expected section start/end symbol name on MacOS when linking libfuzzer
Not only is the section name when adding the sancov variables different.

The linker symbol ending up in the binary is also different.

Reference: 60105ac6ba/llvm/lib/Transforms/Instrumentation/SanitizerCoverage.cpp (L1076-L1104)
2025-04-26 15:07:21 +02:00
Alex Rønne Petersen
a8844ab3bc
std.Target.amdgcn.cpu.gfx1153 doesn't exist in LLVM 19. 2025-04-25 20:14:44 +02:00
Ryan Liptak
aa013b7643
FailingAllocator: remove outdated doc comments, move doc comment example to decltest
Note: The decltests for files-as-a-struct don't show up in autodoc currently
2025-04-25 19:58:11 +02:00
Ali Cheraghi
f38a28a626
revive nvptx linkage 2025-04-25 19:57:45 +02:00