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

Compiler error using @clz on Vector(x, {u32,i32}) #10147

Closed
1 task done
schmee opened this issue Nov 14, 2021 · 0 comments · Fixed by #10155
Closed
1 task done

Compiler error using @clz on Vector(x, {u32,i32}) #10147

schmee opened this issue Nov 14, 2021 · 0 comments · Fixed by #10155
Labels
bug Observed behavior contradicts documented or intended behavior stage1 The process of building from source via WebAssembly and the C backend.
Milestone

Comments

@schmee
Copy link
Sponsor Contributor

schmee commented Nov 14, 2021

Remember to search before filing a new report

  • I searched for this bug and did not find it in the issue tracker, and furthermore, the title I used above will make this new bug report turn up in the search results for my query.

Zig Version

0.9.0-dev.1625+d3a099c14

Steps to Reproduce

// Same thing happens with i32, but no other type I tried
const Int = u32;
const V = Vector(4, Int); // <-- seems `len` of the vector doesn't matter for the crash

pub fn zeroes() V {
    return [_]Int{0, 0, 0, 0};
}

pub fn main() !void {
    // This works!
    // const v = [_]Int{0, 0, 0, 0};
    const v = zeroes();

    // @ctz and @popCount works
    const x = @clz(Int, v);
    debug.print("{d}", .{x});
}

Expected Behavior

No compiler error.

Actual Behavior

broken LLVM module found: Call parameter type does not match function signature!
  %5 = extractvalue { i32, i1 } %4, 0, !dbg !17320
 <4 x i32>  %7 = call <4 x i32> @llvm.ctlz.v4i32(i32 %5, i1 false), !dbg !17321
trunc source and destination must both be a vector or neither
  %8 = trunc <4 x i32> %7 to i6, !dbg !17321

This is a bug in the Zig compiler.thread 3267800 panic:
Unable to dump stack trace: debug info stripped
@schmee schmee added the bug Observed behavior contradicts documented or intended behavior label Nov 14, 2021
LemonBoy added a commit to LemonBoy/zig that referenced this issue Nov 15, 2021
The cache entry must take into account the fact some functions operate on scalar types and some other on vectors of scalar types.

Fixes ziglang#10147
LemonBoy added a commit to LemonBoy/zig that referenced this issue Nov 15, 2021
The cache entry must take into account the fact some functions operate on scalar types and some other on vectors of scalar types.

Fixes ziglang#10147
LemonBoy added a commit to LemonBoy/zig that referenced this issue Nov 15, 2021
The cache entry must take into account the fact some functions operate on scalar types and some other on vectors of scalar types.

Fixes ziglang#10147
andrewrk pushed a commit that referenced this issue Nov 16, 2021
The cache entry must take into account the fact some functions operate on scalar types and some other on vectors of scalar types.

Fixes #10147
@andrewrk andrewrk added this to the 0.9.0 milestone Nov 16, 2021
@andrewrk andrewrk added the stage1 The process of building from source via WebAssembly and the C backend. label Nov 16, 2021
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 stage1 The process of building from source via WebAssembly and the C backend.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants