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

Defining panic function with a comptime parameter results in compiler crash #1894

sjdh02 opened this Issue Jan 22, 2019 · 0 comments


None yet
2 participants
Copy link

sjdh02 commented Jan 22, 2019

Compiler version (master):


If a panic handler function is defined like so:

pub fn panic(comptime msg: []const u8, error_return_trace: ?*builtin.StackTrace) noreturn

The compiler crashes like so on Windows:

The following command exited with error code -1073741819:
c:\Program Files\zig\zig.exe build-exe C:\Users\sam\Code\tos\src\kernel.zig --assembly C:\Users\sam\Code\tos\src\asm\pmio.S --assembly C:\Users\sam\Code\tos\src\asm\flush.S --cache-dir C:\Users\sam\Code\tos\zig-cache --output C:\Users\sam\Code\tos\zig-cache\kernel --name kernel --static --target-arch i386 --target-os freestanding --target-environ unknown --linker-script ./linker.ld 

Build failed. The following command failed:
C:\Users\sam\AppData\Local\zig\stage1\artifact\gQG_isLeNaPy_f0_YUndBSfay3pFNKdFU6XbFDkuu58Zh7w877MtPKlJqkiphh2d\build.exe c:\Program Files\zig\zig.exe C:\Users\sam\Code\tos C:\Users\sam\Code\tos\zig-cache

I assume this is because the compiler expects the panic function to be defined without the comptime, so maybe an error message like so would be appropriate:

error: expected 'fn([]const u8, ?*builtin.StackTrace) noreturn', found 'fn(comptime []const u8, ?*builtin.StackTrace) noreturn'

@andrewrk andrewrk added the bug label Jan 22, 2019

@andrewrk andrewrk added this to the 0.4.0 milestone Jan 22, 2019

@andrewrk andrewrk closed this in a05e224 Feb 16, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.