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

Compilation stuck when using IntegerBitSet #22297

Open
maxandron opened this issue Dec 23, 2024 · 4 comments
Open

Compilation stuck when using IntegerBitSet #22297

maxandron opened this issue Dec 23, 2024 · 4 comments
Labels
arch-aarch64 64-bit ARM backend-llvm The LLVM backend outputs an LLVM IR Module. bug Observed behavior contradicts documented or intended behavior
Milestone

Comments

@maxandron
Copy link

Zig Version

0.13.0

Steps to Reproduce and Observed Behavior

New to Zig. After incorporating bit_set.IntegerBitSet the build is stuck indefinitely when building with zig run or zig build-exe.
It only shows LLVM Emit Object and is stuck in a loop on 100% CPU.

This happens when passing a size above 2^12 (above 4096)

Minimal reproducible example:

const std = @import("std");

pub fn main() !void {
    var bitmap = std.bit_set.IntegerBitSet(4097).initEmpty();
    bitmap.set(2);
}

I realize this is an error on my part (should have used StaticBitSet or ArrayBitSet). But the compiler behavior is still unexpected.

Expected Behavior

An error message that the size is too big with a tip to use an ArrayBitSet/StaticBitSet instead?

@maxandron maxandron added the bug Observed behavior contradicts documented or intended behavior label Dec 23, 2024
@Vexu
Copy link
Member

Vexu commented Dec 23, 2024

Compiles without issues using master branch Zig.

@maxandron
Copy link
Author

maxandron commented Dec 23, 2024

I didn't mention I'm on a Mac (M3 Pro)
Tested now with 0.14.0-dev.2547+77c63ac36 (zig-macos-aarch64-0.14.0-dev.2547+77c63ac36)

And the issue persists

So maybe it's an LLVM on Mac issue?

image

@Vexu
Copy link
Member

Vexu commented Dec 23, 2024

I can reproduce with -target aarch64-linux so the issue is aarch64.

@Vexu Vexu added arch-aarch64 64-bit ARM backend-llvm The LLVM backend outputs an LLVM IR Module. labels Dec 23, 2024
@Vexu Vexu added this to the 0.15.0 milestone Dec 23, 2024
@Rexicon226
Copy link
Contributor

A reduction:

target datalayout = "e-m:o-i64:64-i128:128-n32:64-S128-Fn32"
target triple = "aarch64-apple-macosx13.0.0-unknown"

define fastcc i4097 @foo(i4097 %0) {
  %2 = shl i4097 0, %0
  ret i4097 %2
}

Hits "processing time exceeded" on godbolt: https://clang.godbolt.org/z/hhs7zGeK3

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
arch-aarch64 64-bit ARM backend-llvm The LLVM backend outputs an LLVM IR Module. bug Observed behavior contradicts documented or intended behavior
Projects
None yet
Development

No branches or pull requests

3 participants