-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Open
Labels
enhancementSolving this issue will likely involve adding new logic or components to the codebase.Solving this issue will likely involve adding new logic or components to the codebase.standard libraryThis issue involves writing Zig code for the standard library.This issue involves writing Zig code for the standard library.
Milestone
Description
Zig Version
0.12.0-dev.3381+7057bffc1
Steps to Reproduce and Observed Behavior
Scenario 1:
inline fn repro() void {
@panic("");
}
pub fn main() void {
repro();
}
Output:
$ zig run repro.zig
thread 147441 panic:
.../repro.zig:2:5: 0x1033fef in main (repro)
@panic("");
^
.../lib/zig/std/start.zig:501:22: 0x1033899 in posixCallMainAndExit (repro)
root.main();
^
.../lib/zig/std/start.zig:253:5: 0x1033401 in _start (repro)
asm volatile (switch (native_arch) {
^
Scenario 2:
inline fn repro() !void {
try other();
}
fn other() !void {
return error.Fail;
}
pub fn main() !void {
try repro();
}
Output:
$ zig run repro.zig
error: Fail
.../repro.zig:6:5: 0x1033c98 in other (repro)
return error.Fail;
^
.../repro.zig:10:5: 0x1033dc7 in main (repro)
try repro();
^
Expected Behavior
Expected output is as if the function wasn't inline
.
Expected 1:
$ zig run repro.zig
thread 147991 panic:
.../repro.zig:2:5: 0x1035fdf in repro (repro)
@panic("");
^
.../repro.zig:6:10: 0x1034008 in main (repro)
repro();
^
.../lib/zig/std/start.zig:501:22: 0x10338c9 in posixCallMainAndExit (repro)
root.main();
^
.../zig/std/start.zig:253:5: 0x1033431 in _start (repro)
asm volatile (switch (native_arch) {
^
Expected 2:
$ zig run repro.zig
error: Fail
.../repro.zig:6:5: 0x1033cc8 in other (repro)
return error.Fail;
^
.../repro.zig:2:5: 0x1033dd3 in repro (repro)
try other();
^
.../repro.zig:10:5: 0x1033e13 in main (repro)
try repro();
^
mpfaff
Metadata
Metadata
Assignees
Labels
enhancementSolving this issue will likely involve adding new logic or components to the codebase.Solving this issue will likely involve adding new logic or components to the codebase.standard libraryThis issue involves writing Zig code for the standard library.This issue involves writing Zig code for the standard library.