642 Commits
Author SHA1 Message Date
Andrew Kelley def373ed78 Merge pull request 'llvm: pass some behavior tests (30%) for spirv target' (#37300) from alichraghi/zig:llvm-spirv into master
Reviewed-on: https://codeberg.org/ziglang/zig/pulls/37300
Reviewed-by: Andrew Kelley <andrew@ziglang.org>
2026-10-24 22:34:19 +02:00
Ali Cheraghi b60a4af44c llvm: fix blocking issues to get tests running 2026-10-23 09:18:03 +03:30
CMDRZero 64e4f9db8f Implement partially ordered operator precedence 2026-10-22 12:21:43 +02:00
Jacob Young f08a8f0fc2 main: reimplement compiler debug flags
* Add `.llvmbc`/`.llvmir` to `ObjectFormat` for emitting unoptimized IR
* Replace `--verbose-air`, `--verbose-intern-pool`,
  `--verbose-generic-instances`, `--verbose-llvm-ir`, and
  `--verbose-llvm-bc` with various `--debug-log` scopes
  * `--debug-log illegal-air`: pre-legalized Air
  * `--debug-log legal-air`: post-legalized Air
  * `--debug-log air`: final Air with liveness
  * `--debug-log ip-stats`: InternPool statistics
  * `--debug-log ip-values`: InternPool values
  * `--debug-log ip-generic-instances`: InternPool generic instances
  * `--debug-log llvm-ir`: pre-optimized LLVM IR
  * `--debug-log opt-llvm-ir`: post-optimized LLVM IR
* Delete `--verbose-cimport` which does nothing
* Delete `--verbose-llvm-cpu-features` which is equivalent to looking at
  the outputs of `--show-builtin` and `--debug-log llvm-ir`
2026-10-21 10:04:01 -07:00
Andrew Kelley 6b2ac8fa5c std.debug.assert: remove @disableInstrumentation
This was included as part of 5d58306162
but there was no mention of it in the commit message and I didn't notice
it in the review.

This is a partial (one-line) revert. Let's discuss this change carefully
and separately.
2026-10-09 17:46:28 -07:00
Alex Rønne Petersen 0375ec45ab std.debug: remove sys_can_stack_trace prong for avr
https://github.com/llvm/llvm-project/pull/228967

closes https://codeberg.org/ziglang/zig/issues/31127
2026-10-07 06:48:23 +02:00
Jay Petacat d7148f7d05 std.debug.SafetyLock: add support for shared locking
The existing `lock` and `unlock` methods continue to act exclusively.
They should be used when data may be mutated. New methods, `lockShared`
and `unlockShared`, may be used for shared locking in situations where
multiple independent users are reading but not mutating data.
2026-09-09 02:18:52 +02:00
Alex Rønne Petersen fb1e767ff8 std.debug: apply stack bias to the frame pointer fetched from the CPU context
Unbreaks segfault stack tracing on SPARC.
2026-08-28 14:16:50 +02:00
Alex Rønne Petersen 9ae517714e std.debug: remove SPARC workaround in handleSegfaultPosix()
This no longer appears to be needed.
2026-08-28 14:16:16 +02:00
marximimus 5a625d5f3c fix memory leak in StackIterator
partial fix for #36533
2026-08-28 09:45:15 +02:00
Andrew Kelley c6204ba3c2 Merge pull request 'spork8 backend' (#36627) from spork8 into master
Reviewed-on: https://codeberg.org/ziglang/zig/pulls/36627
2026-08-27 21:18:14 +02:00
Kleshzz c3723c05f0 std.Target: add gba os tag 2026-08-27 14:35:44 +02:00
Andrew Kelley 03cc522fc0 spork8: object format is .bin extension (raw machine code) 2026-08-26 20:54:49 -07:00
Andrew Kelley 3cd05f8a1b init spork8 backend 2026-08-26 20:54:49 -07:00
xtex 4605f7fbbf std: support loongarch backend 2026-08-09 11:10:26 +08:00
Meghan Denny e88566253d sema: improve @errorCast safety check message 2026-08-05 03:29:37 +02:00
Matthew Lugg 5f74e4f3f8 Sema: make loading uninstantiable types a runtime safety panic
For generic code, it is far more useful to consider this equivalent to
`unreachable`. Meanwhile, it is difficult to accidentally write concrete
code which performs this operation, so very little is actually lost from
not having a compile error.

If we accept that this operation does not trigger a compile error, then
it already has the potential to invoke Illegal Behavior today, because
uninstantiable types have an unspecified size in memory, so the
dereference always potentially exceeds the pointer's provenance. (That
said, this only means it is *possible* for the operation to invoke IB,
so the langspec should nonetheless explicitly specify that dereferencing
a pointer to an uninstantiable type is itself Illegal Behavior.)

Storing uninstantiable types into memory does not require any specific
language rules, because that operation can never be reached anyway due
to it requiring an operand (the RHS of `a = b`) whose type is the store
type, which is (by definition) impossible for uninstantiable types.

Resolves: https://codeberg.org/ziglang/zig/issues/36247
2026-08-04 22:29:50 +02:00
Andrew Kelley f2c2ee28cb std.lang.Optimize: provide alternative to std.debug.runtime_safety 2026-07-20 17:26:50 -07:00
Andrew Kelley ae4e835a66 std.lang: rename OptimizeMode to Optimize
and remove "release" from the enum tag names.

no functional change, however, despite the addition of
backwards-compatibile declarations in this patch, it is breaking because
expressions that use `==` or `!=` operators will not able to use the
deprecated names.

I predict these names to survive until the 1.0 tag without any more
breakage.
2026-07-20 17:26:50 -07:00
Justus Klausecker 69a26976ed zig fmt
Converts usages of `@intFromEnum` and `@enumFromInt` to instead use the
new `@backingInt` and `@fromBackingInt` builtins.
2026-07-17 23:30:26 +02:00
Andrew Kelley de7fdfecd8 Merge pull request 'compiler: implement @divCeil builtin' (#36043) from pavelverigo/zig:div-ceil into master
Reviewed-on: https://codeberg.org/ziglang/zig/pulls/36043
Reviewed-by: Andrew Kelley <andrew@ziglang.org>
2026-07-08 21:15:24 +02:00
Alex Rønne Petersen 164578636c std.Target: add switch (Nintendo Switch) Os tag
contributes to https://codeberg.org/ziglang/zig/issues/31341
2026-07-07 15:34:40 +02:00
Pavel Verigo efcaf6a72d lib: use @divCeil 2026-07-06 20:49:09 +02:00
Pavel Verigo ba5420896d Enable std tests for wasm backend again + enable field reordering
Additionally remove some skips, closes #30575
2026-06-29 13:22:20 +02:00
Leon Lombar 84f84267c7 std.Target: add PSX
Adds target info for the PSX. Builds fine with the following:
```zig
const target = b.resolveTargetQuery(.{
    .os_tag = .psx,
    .cpu_arch = .mipsel,
});
```
the only "problem" being that it spits out an error from LLVM even
though generating an object file succeeds:
```sh
❯ zig build
install
└─ install generated to main.o
   └─ compile obj obj Debug mipsel-psx failure
error: warning: MIPS-I support is experimental
```
2026-06-19 04:22:55 +02:00
Jari Vetoniemi 7255f3e724 std.debug: add TargetInfo function which returns the default SelfInfo
If one overrides `SelfInfo` in their `root.debug`, it is no longer possible
to refer to the default `SelfInfo` that the std.debug uses.

This allows the developer to still refer to the std's default without
copying the SelfInfo zig files to their project.
2026-06-17 23:17:01 +02:00
ARandomOSDever eedf7d9299 std.Target: add wiiu OS tag 2026-06-17 22:45:00 +02:00
Lukas Lalinsky 041ae87b98 Avoid error.Canceled swallowing in `std.debug.* 2026-06-11 06:05:18 +02:00
Alex Rønne Petersen 68d2bef8c0 std.debug: FP unwinding is useless on xtensa
Like MIPS, we'd have to do backwards code scanning for it to be useful, and at
least for now, we're not willing to do that.
2026-05-26 08:11:04 +02:00
Alex Rønne Petersen 6e6df11027 std.debug: trap on psp in defaultPanic() 2026-05-23 05:47:34 +02:00
Andrew Kelley 3d56df1716 Merge pull request 'std.fmt, std.mem.Allocator: Remove bufPrintZ()/dupeZ() in favor of bufPrintSentinel()/dupeSentinel()' (#35190) from linus/zig:deprecated-std-fmt-mem into master
Reviewed-on: https://codeberg.org/ziglang/zig/pulls/35190
Reviewed-by: Andrew Kelley <andrew@ziglang.org>
2026-05-06 19:34:52 +02:00
Alex Rønne Petersen 994547d19a std.debug: disable stack traces on avr
https://codeberg.org/ziglang/zig/issues/31127
2026-05-06 16:03:56 +02:00
Linus Groh fcc0a5a913 std.mem.Allocator: Remove dupeZ() in favor of dupeSentinel() 2026-05-03 21:42:16 +01:00
Matthew Lugg fdac89d6cd remove uses of array multiplication
In preparation for its removal as accepted in
https://github.com/ziglang/zig/issues/24738.
2026-04-30 08:57:51 +01:00
Mason Remaley e2c3920fb1 Renames buffer first allocator in compiler and std 2026-04-18 14:51:49 -07:00
Elaine Gibson db63e4725a std.debug: fix handleSegfaultPosix for haiku 2026-04-14 19:10:21 +01:00
Mason Remaley 6707a5efee Arena allocates text 2026-04-13 01:30:14 -07:00
Mason Remaley 4ad665d3c8 Writes symbols to array list argument 2026-04-12 23:50:24 -07:00
Mason Remaley e968e6d004 Fixes typos/out of date comments, switches to unstable sort 2026-04-12 14:09:22 -07:00
Mason Remaley df2413cf69 Removes dead code, updates some tests, fixes typos in comments, formats 2026-04-12 04:01:30 -07:00
Mason Remaley 541bd6c369 Updates more failing tests 2026-04-12 04:01:30 -07:00
Mason Remaley ac207073f3 Reverts renaming of builtin.StackTrace -> ErrorReturnTrace
We can defer this change until the next time zig1 needs to be updated
2026-04-12 04:01:30 -07:00
Mason Remaley 4efbb27aa2 Don't bother resolving symbol names that won't be used
Also fixes some memory management issues
2026-04-12 04:01:30 -07:00
Mason Remaley f6a3a0ca72 Replaces the inline symbol iterator with an array of symbols
The intention behind the iterator was to avoid needing to allocate the
symbols, but in practice we need to allocate them anyway since we need
to reverse their order and don't have random access. The alternative
would be an N^2 algorithm.

In practice this isn't that bad, because even if the allocation fails,
we'll still end up printing the address, so the user still ends up with
the necessary information to reconstruct the crash. I don't think it's
worth it to try to set up some kind of ring buffer or return partial
results on failure, but may revisit this.
2026-04-12 04:01:30 -07:00
Mason Remaley c2cbb944ba Further improvements to stack trace type 2026-04-12 04:01:29 -07:00
Mason Remaley 6bf583c4ba Further separation of stack trace and error return trace 2026-04-12 04:01:29 -07:00
Mason Remaley 94ff38af87 Separates error return traces from stack traces
Doesn't commit the changes to stage1, we can generate those at the end
once we're not making any more changes to it to avoid wasting storage.
2026-04-12 04:01:29 -07:00
Mason Remaley 094e841f09 Don't print column if column info is missing 2026-04-12 04:01:29 -07:00
Mason Remaley 156f54d8f0 Adds includes_inlined_frames option to builtin.StackTrace
This will be relevant once #31605 is merged.

In general, stack traces do *not* contain unique addresses for inlined
frames, but for error return traces, they will after the above PR. This
bool indicates that code printing the trace should not try to resolve
inline frames since they're explicitly encoded into the instruction
addresses.

This is set as state on stack trace rather than passed into the
formatting methods as an argument, as it's not really a formatting
option--whether or not it's correct to resolve inlines is decided at the
time of capture!
2026-04-12 04:01:29 -07:00
Mason Remaley 22f9592dc7 First pass at reading inline info from PDBs 2026-04-12 04:01:29 -07:00