Skip to content

Zig-generated function names can clash with LLVM intrinsics #11525

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

Closed
distractedlambda opened this issue Apr 25, 2022 · 1 comment
Closed

Zig-generated function names can clash with LLVM intrinsics #11525

distractedlambda opened this issue Apr 25, 2022 · 1 comment
Labels
bug Observed behavior contradicts documented or intended behavior

Comments

@distractedlambda
Copy link

Zig Version

0.10.0-dev.1931+ab658e32b

Steps to Reproduce

Create a file called llvm.zig with a pub function in it:

pub fn foo() {}

and a root source that depends on it (e.g. root.zig):

comptime {
    _ = @import("llvm.zig").foo;
}

Then try to compile root.zig, e.g.

zig build-obj root.zig

Expected Behavior

The compilation succeeds and produces an object file.

Actual Behavior

The compilation fails with this output:

broken LLVM module found: llvm intrinsics cannot be defined!
void ()* @llvm.foo

This is a bug in the Zig compiler.
@distractedlambda distractedlambda added the bug Observed behavior contradicts documented or intended behavior label Apr 25, 2022
@ifreund
Copy link
Member

ifreund commented Apr 25, 2022

Thanks for the bug report! I'm going to close this as a duplicate of #2291 since they have the same root cause and fix.

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