`shared_lib_unwind` test fails with LLVM 19 on `x86_64-macos`
Zig Version
llvm19 branch
Steps to Reproduce and Observed Behavior
slices differ. first difference occurs at index 4 (0x4)
============ expected this output: ============= len: 5 (0x5)
[0]: 4470704853
[1]: 4470699637
[2]: 4472813037
[3]: 447[2813](https://github.com/ziglang/zig/actions/runs/10728463483/job/29753056611#step:3:2814)200
[4]: 4470699404
============= instead found this: ============== len: 5 (0x5)
[0]: 4470704853
[1]: 4470699637
[2]: 4472813037
[3]: 4472813200
[4]: 0
================================================
error: TestExpectedEqual
/Users/runner/work/zig/zig/build/../lib/std/testing.zig:401:5: 0x10a796ff2 in expectEqualSlices__anon_1655 (shared_lib_unwind)
return error.TestExpectedEqual;
^
/Users/runner/work/zig/zig/build/../lib/std/testing.zig:122:27: 0x10a7974f0 in expectEqualInner__anon_1590 (shared_lib_unwind)
.array => |array| try expectEqualSlices(array.child, &expected, &actual),
^
/Users/runner/work/zig/zig/test/standalone/stack_iterator/shared_lib_unwind.zig:46:5: 0x10a7975ec in main (shared_lib_unwind)
try testing.expectEqual(expected, unwound);
^
test
+- test-standalone
+- standalone_test_cases
+- standalone_test_cases.stack_iterator
+- run shared_lib_unwind failure
error: the following command exited with error code 1:
/Users/runner/work/zig/zig/build/zig-local-cache/o/28ff8aee07c6096c08071886739901cc/shared_lib_unwind
Build Summary: 7118/7358 steps succeeded; 235 skipped; 1 failed; 37599/38966 tests passed; 1367 skipped
test transitive failure
+- test-standalone transitive failure
+- standalone_test_cases transitive failure
+- standalone_test_cases.stack_iterator transitive failure
+- run shared_lib_unwind failure
error: the following build command failed with exit code 1:
/Users/runner/work/zig/zig/build/zig-local-cache/o/6cf341a4a5e0ae7e7bdbe78ce9db8a1f/build /Users/runner/work/zig/zig/build/stage3/bin/zig /Users/runner/work/zig/zig/build/../lib /Users/runner/work/zig/zig /Users/runner/work/zig/zig/build/zig-local-cache /Users/runner/work/zig/zig/build/zig-global-cache --seed 0x22c0efb9 -Z03c91678fd6fa3aa test docs -Denable-macos-sdk -Dstatic-llvm -Dskip-non-native --search-prefix /Users/runner/zig+llvm+lld+clang-x86_64-macos-none-0.14.0-dev.1499+0006b56f4
Expected Behavior
No failure.
(Drive-by speculation from an LLVM noob.)
The test (if I found the right one) calls extern fn frame0, provided here,
which writes expected[4] = __builtin_extract_return_addr(__builtin_return_address(0));,
yet when we unwind here we no longer find that entry.
Maybe the compiler's optimizations changed? While frame1 is marked __attribute(noinline)__, I'm not sure whether that would prohibit tail call optimization. (Or theoretically inlining of frame0 into frame1? Could that be considered viable, since (I think?) we perform LTO? But then the return address would have to be the same I think.)
For disabling tail-calls there seem to exist attributes disable_tail_calls for marking the caller and not_tail_called for marking the callee - maybe one or both of those would change the behavior.