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

@bitCast generates invalid LLVM IR #1934

Closed
andrewrk opened this Issue Feb 7, 2019 · 0 comments

Comments

Projects
None yet
1 participant
@andrewrk
Copy link
Member

andrewrk commented Feb 7, 2019

const A = struct {
    value: u64,
};

fn foobar(param: usize) void {
    bar(@bitCast(A, param));
}

fn bar(param: A) void {}

test "aoeu" {
    foobar(1024);
}

expected some kind of error about not being allowed to bitcast a non-extern, non-packed struct.

instead got this:

Invalid bitcast
  %2 = bitcast i64 %1 to %A, !dbg !574
Call parameter type does not match function signature!
  %2 = bitcast i64 %1 to %A, !dbg !574
 %A*  call fastcc void @bar(%A %2), !dbg !575
LLVM ERROR: Broken module found, compilation aborted!

thanks to IRC user gamester for the report.

@andrewrk andrewrk added the bug label Feb 7, 2019

@andrewrk andrewrk added this to the 0.4.0 milestone Feb 7, 2019

@andrewrk andrewrk closed this in 0c5f897 Feb 22, 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.