[LLVMdev] Assert with getZExtValue()?

Eli Friedman eli.friedman at gmail.com
Fri Nov 16 15:10:18 PST 2012


On Fri, Nov 16, 2012 at 3:00 PM, Ryan Taylor <ryta1203 at gmail.com> wrote:
> Was hoping it might get some help or a better explanation of this:
>
> /ADT/APInt.h:1217: uint64_t llvm::APInt::getZExtValue() const: Assertion
> `getActiveBits() <= 64 && "Too many bits for uint64_t"' failed.

The error message is exactly what it says: you're trying to call
getZExtValue() on an APInt whose value doesn't fit into a uint64_t.

> Program received signal SIGABRT, Aborted.
> 0x00007ffff6eb4d05 in raise (sig=6) at
> ../nptl/sysdeps/unix/sysv/linux/raise.c:64
> 64    ../nptl/sysdeps/unix/sysv/linux/raise.c: No such file or directory.
>     in ../nptl/sysdeps/unix/sysv/linux/raise.c
> (gdb) bt
> #0  0x00007ffff6eb4d05 in raise (sig=6) at
> ../nptl/sysdeps/unix/sysv/linux/raise.c:64
> #1  0x00007ffff6eb8ab6 in abort () at abort.c:92
> #2  0x00007ffff6ead7c5 in __assert_fail (
>     assertion=0x7ffff6c7c907 "getActiveBits() <= 64 && \"Too many bits for
> uint64_t\"",
>     file=<value optimized out>, line=1217, function=<value optimized out>)
> at assert.c:81
> #3  0x00007ffff6c6c5cf in getZExtValue (this=<value optimized out>)
>     at /home/ryan/llvm/llvm_core/trunk/include/llvm/ADT/APInt.h:1217
> #4  getZExtValue (this=<value optimized out>)
>     at /home/ryan/llvm/llvm_core/trunk/include/llvm/Constants.h:117
> #5  cdfgPassClass::storeInstr (this=<value optimized out>) at
> a2c_pass.cpp:2125
> #6  0x00007ffff6c73dc1 in (anonymous namespace)::CDFGPass::runOnModule
> (this=0x16c2fa0,
>     M=<value optimized out>) at a2c_pass.cpp:2949
> #7  0x0000000000f4cd4e in llvm::MPPassManager::runOnModule(llvm::Module&) ()
> #8  0x0000000000f4d813 in llvm::PassManagerImpl::run(llvm::Module&) ()
> #9  0x0000000000f4d94a in llvm::PassManager::run(llvm::Module&) ()
> #10 0x0000000000525509 in main ()
>
> Also, why does it give <value optimized out>, when I print the value I
> clearly get one, unless this is some result of const prop?

No clue how gdb decides these things.  If you file a bug with a
reduced testcase, someone might find the answer.

-Eli



More information about the llvm-dev mailing list