Skip to content

behavior tests are tripping an LLVM assertion on mips-linux: Invalid shift amount #13782

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
andrewrk opened this issue Dec 5, 2022 · 3 comments
Labels
arch-mips 32-bit and 64-bit MIPS backend-llvm The LLVM backend outputs an LLVM IR Module. bug Observed behavior contradicts documented or intended behavior frontend Tokenization, parsing, AstGen, Sema, and Liveness. os-linux regression It worked in a previous version of Zig, but stopped working. upstream An issue with a third party project that Zig uses.
Milestone

Comments

@andrewrk
Copy link
Member

andrewrk commented Dec 5, 2022

Zig Version

0.11.0-dev.526+9e74e4c1f

Steps to Reproduce and Observed Behavior

Reproduction requires an LLVM built with assertions enabled. This is documented in the wiki and these assertions are one of the reasons it is recommended to work on the Zig compiler with an LLVM source build rather than the one provided by a system package.

$ stage4/bin/zig test ../test/behavior.zig -I../test -target mips-linux-none
LLVM Emit Object... zig: /home/andy/Downloads/llvm-project-15/llvm/include/llvm/ADT/APInt.h:840: void llvm::APInt::lshrInPlace(unsigned int): Assertion `ShiftAmt <= BitWidth && "Invalid shift amount"' failed.

Expected Behavior

Expected the behavior tests to pass.

@andrewrk andrewrk added bug Observed behavior contradicts documented or intended behavior os-linux frontend Tokenization, parsing, AstGen, Sema, and Liveness. arch-mips 32-bit and 64-bit MIPS backend-llvm The LLVM backend outputs an LLVM IR Module. regression It worked in a previous version of Zig, but stopped working. labels Dec 5, 2022
@andrewrk andrewrk added this to the 0.10.1 milestone Dec 5, 2022
@jacobly0
Copy link
Member

jacobly0 commented Dec 20, 2022

This appears to be an upstream llvm bug with global non-zero vectors that aren't a multiple of a byte on big-endian targets.

repro

target triple = "mips"
@g = constant <1 x i1> <i1 true>

@nektro
Copy link
Contributor

nektro commented Dec 20, 2022

nice find, upstream llvm/llvm-project#59055

jacobly0 added a commit to jacobly0/zig that referenced this issue Dec 24, 2022
```
LLVM Emit Object... zig: llvm/include/llvm/ADT/APInt.h:840: void llvm::APInt::lshrInPlace(unsigned int): Assertion `ShiftAmt <= BitWidth && "Invalid shift amount"' failed.
Aborted
```

Tracked by ziglang#13782
jacobly0 added a commit to jacobly0/zig that referenced this issue Dec 24, 2022
```
LLVM Emit Object... zig: llvm/include/llvm/ADT/APInt.h:840: void llvm::APInt::lshrInPlace(unsigned int): Assertion `ShiftAmt <= BitWidth && "Invalid shift amount"' failed.
Aborted
```

Tracked by ziglang#13782
candrewlee14 added a commit to candrewlee14/zig that referenced this issue Dec 24, 2022
andrewrk pushed a commit that referenced this issue Dec 24, 2022
```
LLVM Emit Object... zig: llvm/include/llvm/ADT/APInt.h:840: void llvm::APInt::lshrInPlace(unsigned int): Assertion `ShiftAmt <= BitWidth && "Invalid shift amount"' failed.
Aborted
```

Tracked by #13782
andrewrk added a commit that referenced this issue Jan 5, 2023
andrewrk added a commit that referenced this issue Jan 5, 2023
andrewrk added a commit that referenced this issue Jan 9, 2023
@andrewrk andrewrk modified the milestones: 0.10.1, 0.11.0 Jan 10, 2023
andrewrk pushed a commit to candrewlee14/zig that referenced this issue Jan 27, 2023
@DataCorrupted
Copy link

Hi all:

I'm excited to share that we just fixed this in upstream. (llvm/llvm-project@fc1ffb4) This patch should go into LLVM 17.

@Vexu Vexu modified the milestones: 0.11.0, 0.13.0 Mar 29, 2023
@Vexu Vexu added the upstream An issue with a third party project that Zig uses. label Mar 29, 2023
mlugg added a commit to mlugg/zig that referenced this issue Sep 16, 2023
This bug is newly triggered by this test since the value is now
correctly promoted to a comptime-known constant.

Tracked by ziglang#13782
mlugg added a commit to mlugg/zig that referenced this issue Sep 16, 2023
This bug is newly triggered by these tests since some values are now
correctly promoted to comptime-known constants.

Tracked by ziglang#13782
mlugg added a commit to mlugg/zig that referenced this issue Sep 16, 2023
This bug is newly triggered by these tests since some values are now
correctly promoted to comptime-known constants.

Tracked by ziglang#13782
andrewrk pushed a commit to candrewlee14/zig that referenced this issue Sep 17, 2023
mlugg added a commit to mlugg/zig that referenced this issue Sep 20, 2023
This bug is newly triggered by these tests since some values are now
correctly promoted to comptime-known constants.

Tracked by ziglang#13782
SammyJames pushed a commit to SammyJames/zig that referenced this issue Aug 15, 2024
richerfu pushed a commit to richerfu/zig that referenced this issue Oct 28, 2024
@alexrp alexrp modified the milestones: 0.16.0, 0.14.0 Dec 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
arch-mips 32-bit and 64-bit MIPS backend-llvm The LLVM backend outputs an LLVM IR Module. bug Observed behavior contradicts documented or intended behavior frontend Tokenization, parsing, AstGen, Sema, and Liveness. os-linux regression It worked in a previous version of Zig, but stopped working. upstream An issue with a third party project that Zig uses.
Projects
None yet
Development

No branches or pull requests

6 participants