-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Closed
Labels
bugObserved behavior contradicts documented or intended behaviorObserved behavior contradicts documented or intended behavioros-windowsMicrosoft WindowsMicrosoft WindowsregressionIt worked in a previous version of Zig, but stopped working.It worked in a previous version of Zig, but stopped working.
Milestone
Description
Zig Version
0.14.0-dev.40+b8d2323b8
Steps to Reproduce and Observed Behavior
Line numbers in stack traces have regressed recently. I bisected this down to b8d2323.
I can only confirm this on Windows, but this is what I'm seeing:
Incorrect stack trace:
thread 25548 panic: reached unreachable code
C:\cygwin64\home\kcbanner\kit\zig\build-stage3-release\lib\zig\std\debug.zig:412:14: 0x567d3b8d in assert (game.dll.obj)
if (!ok) unreachable; // assertion failure
^
C:\Users\kcbanner\projects\ion\src\asset.zig:1001:15: 0x5680d414 in release (game.dll.obj)
C:\Users\kcbanner\projects\ion\game\src\modes\RenderTestMode.zig:54:36: 0x5683233d in init (game.dll.obj)
errdefer gs.asset_cache.release(cube_handle);
^
C:\Users\kcbanner\projects\ion\game\src\game.zig:80:83: 0x568378be in init (game.dll.obj)
var quat_editor_mode: imgui.QuatEditorMode = .degrees;
^
C:\Users\kcbanner\projects\ion\game\src\game.zig:599:45: 0x5683e274 in loaded (game.dll.obj)
^
C:\Users\kcbanner\projects\ion\game\src\game.zig:424:16: 0x567d1256 in init (game.dll.obj)
gs.?.loaded(game_memory, reloaded) catch |err| {
^
C:\Users\kcbanner\projects\ion\src\main.zig:388:44: 0xb77684 in main (ion.exe.obj)
game_loaded = game_loaded and game.init(&game_memory);
^
C:\cygwin64\home\kcbanner\kit\zig\build-stage3-release\lib\zig\std\start.zig:497:75: 0xb7b39a in main (ion.exe.obj)
return callMainWithArgs(@as(usize, @intCast(c_argc)), @as([*][*:0]u8, @ptrCast(c_argv)), envp);
^
C:\cygwin64\home\kcbanner\kit\zig\build-stage3-release\lib\zig\libc\mingw\crt\crtexe.c:267:0: 0xc27f41 in __tmainCRTStartup (crt2.obj)
mainret = _tmain (argc, argv, envp);
C:\cygwin64\home\kcbanner\kit\zig\build-stage3-release\lib\zig\libc\mingw\crt\crtexe.c:188:0: 0xc27f9b in mainCRTStartup (crt2.obj)
ret = __tmainCRTStartup ();
???:?:?: 0x7ff932f97343 in ??? (KERNEL32.DLL)
???:?:?: 0x7ff93441cc90 in ??? (ntdll.dll)
Correct stack trace ():
c:\Users\kcbanner\projects\ion>zig-debug build && zig-out\bin\ion.exe
thread 26744 panic: reached unreachable code
C:\cygwin64\home\kcbanner\kit\zig\build-stage3-debug\lib\zig\std\debug.zig:412:14: 0x567d3b8d in assert (game.dll.obj)
if (!ok) unreachable; // assertion failure
^
C:\Users\kcbanner\projects\ion\src\asset.zig:454:15: 0x5680d414 in release (game.dll.obj)
assert(load_ref_count <= handle_ref_count.*);
^
C:\Users\kcbanner\projects\ion\game\src\modes\RenderTestMode.zig:54:36: 0x5683233d in init (game.dll.obj)
errdefer gs.asset_cache.release(cube_handle);
^
C:\Users\kcbanner\projects\ion\game\src\game.zig:32:83: 0x568378be in init (game.dll.obj)
return @unionInit(Mode, field.name, try @field(field.type, "init")(gs));
^
C:\Users\kcbanner\projects\ion\game\src\game.zig:343:45: 0x5683e274 in loaded (game.dll.obj)
self.active_mode = try Mode.init(.render_test, self);
^
C:\Users\kcbanner\projects\ion\game\src\game.zig:424:16: 0x567d1256 in init (game.dll.obj)
gs.?.loaded(game_memory, reloaded) catch |err| {
^
C:\Users\kcbanner\projects\ion\src\main.zig:388:44: 0x8d7684 in main (ion.exe.obj)
game_loaded = game_loaded and game.init(&game_memory);
^
C:\cygwin64\home\kcbanner\kit\zig\build-stage3-debug\lib\zig\std\start.zig:497:75: 0x8db39a in main (ion.exe.obj)
return callMainWithArgs(@as(usize, @intCast(c_argc)), @as([*][*:0]u8, @ptrCast(c_argv)), envp);
^
C:\cygwin64\home\kcbanner\kit\zig\build-stage3-debug\lib\zig\libc\mingw\crt\crtexe.c:267:0: 0x987f41 in __tmainCRTStartup (crt2.obj)
mainret = _tmain (argc, argv, envp);
C:\cygwin64\home\kcbanner\kit\zig\build-stage3-debug\lib\zig\libc\mingw\crt\crtexe.c:188:0: 0x987f9b in mainCRTStartup (crt2.obj)
ret = __tmainCRTStartup ();
???:?:?: 0x7ff932f97343 in ??? (KERNEL32.DLL)
???:?:?: 0x7ff93441cc90 in ??? (ntdll.dll
I don't have a simple reduction yet, as this is only occurring in a large project of mine.
The interesting thing is that some of the line numbers are out of range of the actual file contents - for example asset.zig is only 834 lines long, but the stack trace shows 1001.
Bisect log:
git bisect log
git bisect start
# status: waiting for both good and bad commits
# bad: [2b677d1660018434757f9c9efec3c712675e6c47] Sema: fix performance regression
git bisect bad 2b677d1660018434757f9c9efec3c712675e6c47
# status: waiting for good commit(s), bad commit known
# bad: [1ede3af9f6e5923ed1e42cb33e60c0403539c221] std.zig.target: Remove armeb-windows-gnu and aarch64_be-windows-gnu.
git bisect bad 1ede3af9f6e5923ed1e42cb33e60c0403539c221
# status: waiting for good commit(s), bad commit known
# good: [82a934bb912241809ac8029e1fa5843092a7fdf6] Fix futex2_waitv syscall
git bisect good 82a934bb912241809ac8029e1fa5843092a7fdf6
# good: [1fdf13a14825d6e1bd247754e3677cf546ee4020] AstGen: error for redundant `@inComptime()`
git bisect good 1fdf13a14825d6e1bd247754e3677cf546ee4020
# good: [ccd3cc3266762c1fea93cdc0190eaf71718d9e6a] Parse WASM linker flags as base 10, like clang
git bisect good ccd3cc3266762c1fea93cdc0190eaf71718d9e6a
# bad: [5afd774db35e1e12cc49aab5b7f134b741545b80] std: mark Build.args as const
git bisect bad 5afd774db35e1e12cc49aab5b7f134b741545b80
# bad: [edf14777bae56c3a6a155c59f793dc432656c1de] link.Wasm: correctly fetch source location when decl is a type
git bisect bad edf14777bae56c3a6a155c59f793dc432656c1de
# good: [1eaeb4a0a838a783d2060f4e5b3b26b483b26009] Zcu: rework source locations
git bisect good 1eaeb4a0a838a783d2060f4e5b3b26b483b26009
# bad: [f37d0725fa4c6a0b5e4e9ca4d25e2760dc06764d] Sema: fix callconv detection in generic functions
git bisect bad f37d0725fa4c6a0b5e4e9ca4d25e2760dc06764d
# bad: [b8d2323b88e68bb5af061dd7e488f51aa0ae8176] Sema: eliminate Block.src_decl
git bisect bad b8d2323b88e68bb5af061dd7e488f51aa0ae8176
# first bad commit: [b8d2323b88e68bb5af061dd7e488f51aa0ae8176] Sema: eliminate Block.src_decl
Expected Behavior
The line numbers should match the correct version of the stack trace.
squeek502
Metadata
Metadata
Assignees
Labels
bugObserved behavior contradicts documented or intended behaviorObserved behavior contradicts documented or intended behavioros-windowsMicrosoft WindowsMicrosoft WindowsregressionIt worked in a previous version of Zig, but stopped working.It worked in a previous version of Zig, but stopped working.