Skip to content

Atomic Load causes LLVM assertion #6548

Closed

Description

@Aatch

The intrinsics-atomics test fails with the following assertion: void llvm::Instruction::setInstructionSubclassData(unsigned short): Assertion(D & HasMetadataBit) == 0 && "Out of range value put into field"' failed.`. The relevant bit of the stack trace is this:

#4  0x00007ffff4b19c70 in setInstructionSubclassData (D=<optimized out>, this=<optimized out>) at /home/james/projects/rust/compiler/src/llvm/include/llvm/IR/Instruction.h:437
#5  getSubclassDataFromInstruction (this=<optimized out>, D=<optimized out>, this=<optimized out>) at /home/james/projects/rust/compiler/src/llvm/include/llvm/IR/Instructions.h:246
#6  setOrdering (this=<optimized out>, Ordering=<optimized out>) at /home/james/projects/rust/compiler/src/llvm/include/llvm/IR/Instructions.h:197
#7  setAtomic (this=<optimized out>, SynchScope=(llvm::CrossThread | unknown: 457338112), Ordering=<optimized out>) at /home/james/projects/rust/compiler/src/llvm/include/llvm/IR/Instructions.h:216
#8  LLVMBuildAtomicLoad (B=<optimized out>, source=<optimized out>, Name=<optimized out>, order=<optimized out>) at /home/james/projects/rust/compiler/src/rustllvm/RustWrapper.cpp:558

I made a small change to output what AtomicLoad was being given as an ordering: 0xf30eb7a0 though it changes every time.

Activity

  1. Aatch commented on May 17, 2013

    @Aatch
    ContributorAuthor

    @Thiez hope this helps.

  2. Aatch commented on May 17, 2013

    @Aatch
    ContributorAuthor

    Nevermind, found the issue:

    In Rust:

    pub unsafe fn LLVMBuildAtomicLoad(B: BuilderRef,
                                      PointerVal: ValueRef,
                                      Order: AtomicOrdering)
                                   -> ValueRef;

    In C:

    extern "C" LLVMValueRef LLVMBuildAtomicLoad(LLVMBuilderRef B,
                                                LLVMValueRef source,
                                                const char* Name,
                                                AtomicOrdering order)

    The signatures differ. I'm surprised this passed any tests at all, I guess it's pretty hit-and-miss as to whether or not the location contains a 0 or not...

  3. added a commit that references this issue on May 17, 2013
    a3d31f4
  4. emberian commented on May 17, 2013

    @emberian
    Contributor

    This can be closed

  5. thestinger commented on May 17, 2013

    @thestinger
    Contributor

    Fixed by #6550.

  6. added a commit that references this issue on Jan 15, 2021
  7. added a commit that references this issue on Aug 21, 2026
    382361c
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions