Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compile error on empty string debug warn argument #702

Closed
tiehuis opened this issue Jan 18, 2018 · 1 comment
Closed

Compile error on empty string debug warn argument #702

tiehuis opened this issue Jan 18, 2018 · 1 comment
Labels
bug Observed behavior contradicts documented or intended behavior
Milestone

Comments

@tiehuis
Copy link
Member

tiehuis commented Jan 18, 2018

pub fn main() -> %void {
    @import("std").debug.warn("{}", "");
}

Results in the following error:

$ zig build-exe test.zig
zig: /home/me/src/zig/src/ir.cpp:9708: VariableTableEntry* get_fn_var_by_index(FnTableEntry*, size_t): Assertion `gen_param_info != nullptr' failed.

Backtrace

#4  0x0000555555dbc3af in get_fn_var_by_index (fn_entry=0x5555596689a0, index=0) at /home/me/src/zig/src/ir.cpp:9708
#5  0x0000555555dbd560 in ir_analyze_fn_call (ira=0x5555596747a0, call_instruction=0x5555596737a0, fn_entry=0x555557a967f0, fn_type=0x555557a97b50, fn_ref=0x0, first_arg_ptr=0x555559675940, comptime_fn_call=false, fn_inline=FnInlineAuto) at /home/me/src/zig/src/ir.cpp:9986
#6  0x0000555555dbe3b5 in ir_analyze_instruction_call (ira=0x5555596747a0, call_instruction=0x5555596737a0) at /home/me/src/zig/src/ir.cpp:10189
#7  0x0000555555dd0206 in ir_analyze_instruction_nocast (ira=0x5555596747a0, instruction=0x5555596737a0) at /home/me/src/zig/src/ir.cpp:15200
#8  0x0000555555dd09a3 in ir_analyze_instruction (ira=0x5555596747a0, instruction=0x5555596737a0) at /home/me/src/zig/src/ir.cpp:15366
#9  0x0000555555dd0c46 in ir_analyze (codegen=0x5555576d6dc0, old_exec=0x555559668a10, new_exec=0x555559668aa8, expected_type=0x5555576e4b90, expected_type_source_node=0x5555577846d0) at /home/me/src/zig/src/ir.cpp:15417
#10 0x0000555555d6a078 in analyze_fn_ir (g=0x5555576d6dc0, fn_table_entry=0x5555596689a0, return_type_node=0x5555577846d0) at /home/me/src/zig/src/analyze.cpp:3641
#11 0x0000555555d6a367 in analyze_fn_body (g=0x5555576d6dc0, fn_table_entry=0x5555596689a0) at /home/me/src/zig/src/analyze.cpp:3693
#12 0x0000555555d6af7c in semantic_analyze (g=0x5555576d6dc0) at /home/me/src/zig/src/analyze.cpp:3897
#13 0x0000555555d9720b in gen_root_source (g=0x5555576d6dc0) at /home/me/src/zig/src/codegen.cpp:5744
#14 0x0000555555d9843a in codegen_build (g=0x5555576d6dc0) at /home/me/src/zig/src/codegen.cpp:6064
#15 0x0000555555de65c7 in main (argc=3, argv=0x7fffffffdd28) at /home/me/src/zig/src/main.cpp:852
@tiehuis tiehuis added the bug Observed behavior contradicts documented or intended behavior label Jan 18, 2018
@andrewrk andrewrk added this to the 0.2.0 milestone Jan 18, 2018
@andrewrk
Copy link
Member

I believe this is #557. I made it so the above code now does this:

/home/andy/dev/zig/build/lib/zig/std/debug/index.zig:30:23: error: compiler bug: var args can't handle void. https://github.com/zig-lang/zig/issues/557
    stderr.print(fmt, args) catch return;
                      ^
/home/andy/dev/zig/build/test.zig:11:30: note: called from here
    @import("std").debug.warn("{}", "");
                             ^

we'll probably leave #557 broken and only fix it in the self hosted compiler.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Observed behavior contradicts documented or intended behavior
Projects
None yet
Development

No branches or pull requests

2 participants