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

previously working code produces message regarding compiler error #10292

Open
bradclawsie opened this issue Dec 7, 2021 · 2 comments
Open

previously working code produces message regarding compiler error #10292

bradclawsie opened this issue Dec 7, 2021 · 2 comments
Labels
bug Observed behavior contradicts documented or intended behavior regression It worked in a previous version of Zig, but stopped working. stage1 The process of building from source via WebAssembly and the C backend.
Milestone

Comments

@bradclawsie
Copy link

bradclawsie commented Dec 7, 2021

Zig Version

0.9.0-dev.1910+fffa89700

Steps to Reproduce

this function compiled fine until upgrading to this version of zig:

pub fn randStr() [random_str_len:0]u8 {                                                         
    const random_bytes_count = 24;
    var random_bytes: [random_bytes_count]u8 = undefined;                                       
    std.crypto.random.bytes(&random_bytes);
    var s: [random_str_len:0]u8 = undefined; 
    _ = std.fs.base64_encoder.encode(&s, &random_bytes);                                        
    return s;
}

now, I see (I've inserted some newlines)

broken LLVM module found: Call parameter type does not match function signature!              
%id = alloca [32 x i8], align 1                                                            
[33 x i8]*  call fastcc void @.grokloc_security_crypt.randStr([32 x i8]* sret([33 x i8]) %id), !dbg !2779                                                                              Call parameter type does not match function signature!                                        
%bad_id = alloca [32 x i8], align 1                                                        
[33 x i8]*  call fastcc void @.grokloc_security_crypt.randStr([32 x i8]* sret([33 x i8]) %bad_id), !dbg !2787                                                                          Call parameter type does not match function signature!                                        
%3 = getelementptr inbounds { [32 x i8], i16 }, { [32 x i8], i16 }* %0, i32 0, i32 0, !dbg !3442                                                                                       [33 x i8]*  call fastcc void @randStr([32 x i8]* sret([33 x i8]) %3), !dbg !3442                                                                                                                                                                           This is a bug in the Zig compiler.thread 1240 panic:                                        
Unable to dump stack trace: debug info stripped

Expected Behavior

compile like before

Actual Behavior

message about a compiler bug

@bradclawsie bradclawsie added the bug Observed behavior contradicts documented or intended behavior label Dec 7, 2021
@andrewrk andrewrk added the stage1 The process of building from source via WebAssembly and the C backend. label Dec 7, 2021
@andrewrk andrewrk added this to the 0.9.0 milestone Dec 7, 2021
@andrewrk andrewrk added the regression It worked in a previous version of Zig, but stopped working. label Dec 7, 2021
@bradclawsie
Copy link
Author

just a quick clarification here...upon review, my code did indeed have some errors related to type mismatches, and I fixed those

the crux of this issue imho is how zig detects this error and messages the user about it

thanks again, I'm enjoying learning zig

@andrewrk andrewrk modified the milestones: 0.9.0, 0.10.0 Dec 8, 2021
@andrewrk andrewrk modified the milestones: 0.10.0, 0.11.0 Aug 26, 2022
@Vexu Vexu modified the milestones: 0.11.0, 0.13.0 Apr 23, 2023
@RetroDev256
Copy link
Contributor

Is this a duplicate of #9469?

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 regression It worked in a previous version of Zig, but stopped working. stage1 The process of building from source via WebAssembly and the C backend.
Projects
None yet
Development

No branches or pull requests

4 participants