15 Commits

Author SHA1 Message Date
Pavel Verigo 36faf76fe1 AstGen: add missing addRestoreErrRetIndex calls when handling for/while expr
Fixes #30912
2026-04-22 00:17:52 +02: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 9edbf00ddf Enables disabled error trace test on Windows 2026-04-12 04:01:30 -07:00
Mason Remaley 825ba5a350 Adds tests for inline traces 2026-04-12 04:01:30 -07:00
Matthew Lugg 998b714708 Sema: push to error trace when returning from inline function
There is no reason `inline fn`s should not be subject to error tracing:
they are still functions! So, push to the error trace when we return
from one, and add a test checking that inline functions do appear in
error traces.

This also changes how we emit error trace pushes: we no longer duplicate
the AIR `ret` instruction in the "error" and "non-error" code paths. I
suspect this will lead to slightly better unoptimized codegen, but I may
be wrong---I'll take some performance measurements before I merge this.
2026-04-10 23:17:22 +02:00
Alex Rønne Petersen f75e4027bd test: disable an error trace test on optimized aarch64-netbsd 2026-03-02 15:08:37 +01:00
Alex Rønne Petersen b781615e09 test: disable an error trace test on optimized aarch64-freebsd 2026-02-27 08:49:27 +01:00
Alex Rønne Petersen 016255ad09 test: disable an error trace test on optimized x86_64-netbsd 2026-01-19 13:16:11 +01:00
Alex Rønne Petersen bb46709762 test: disable an error trace test on optimized x86_64-openbsd 2026-01-07 05:42:49 +01:00
Alex Rønne Petersen f36949ead3 test: disable an error trace test on optimized powerpc64le 2025-12-16 06:22:46 +01:00
Alex Rønne Petersen 41f7f3d4d5 test: disable an error trace test on optimized s390x-linux 2025-11-19 01:42:45 +01:00
Alex Rønne Petersen 9327aaefb6 test: disable an error trace test on optimized riscv64-linux 2025-10-01 12:58:20 +02:00
Alex Rønne Petersen 43806cf0bd test: disable an error trace test on optimized x86_64-freebsd and loongarch64-linux 2025-10-01 01:06:07 +02:00
mlugg e9c0d43c5b test-error-traces: skip some more optimized traces 2025-09-30 13:44:54 +01:00
mlugg 1a8a8c610d tests: split up and enhance stack trace tests
Previously, the `test-stack-traces` step was essentially just testing
error traces, and even there we didn't have much coverage. This commit
solves that by splitting the "stack trace" tests into two separate
harnesses: the "stack trace" tests are for actual stack traces (i.e.
involving stack unwinding), while the "error trace" tests are
specifically for error return traces.

The "stack trace" tests will test different configurations of:

* `-lc`
* `-fPIE`
* `-fomit-frame-pointer`
* `-fllvm`
* unwind tables (currently disabled)
* strip debug info (currently disabled)

The main goal there is to test *stack unwinding* under different
conditions. Meanwhile, the "error trace" tests will test different
configurations of `-O` and `-fllvm`; the main goal here, aside from
checking that error traces themselves do not miscompile, is to check
whether debug info is still working even in optimized builds. Of course,
aggressive optimizations *can* thwart debug info no matter what, so as
before, there is a way to disable cases for specific targets / optimize
modes.

The program which converts stack traces into a more validatable format
by removing things like addresses (previously `check-stack-trace.zig`,
now `convert-stack-trace.zig`) has been rewritten and simplified. Also,
thanks to various fixes in this branch, several workarounds have become
unnecessary: for instance, we don't need to ignore the function name
printed in stack traces in release modes, because `std.debug.Dwarf` now
uses the correct DIE for inlined functions!

Neither `test-stack-traces` nor `test-error-traces` does general foreign
architecture testing, because it seems that (at least for now) external
executors often aren't particularly good at handling stack tracing
correctly (looking at you, Wine). Generally, they just test the native
target (this matches the old behavior of `test-stack-traces`). However,
there is one exception: when on an x86_64 or aarch64 host, we will also
test the 32-bit version (x86 or arm) if the OS supports it, because such
executables can be trivially tested without an external executor.

Oh, also, I wrote a bunch of stack trace tests. Previously there was,
erm, *one* test in `test-stack-traces` which wasn't for error traces.
Now there are a good few!
2025-09-30 13:44:53 +01:00