[LLVMdev] Assert with getZExtValue()?

Ryan Taylor ryta1203 at gmail.com
Fri Nov 16 15:10:31 PST 2012


My apologies, here is the corresponding code:

         if (const Constant *CV = dyn_cast<ConstantInt>(V)) {
            if (CV && !isa<GlobalValue>(CV)) {
               if (const ConstantInt *CI = dyn_cast<ConstantInt>(CV)) {
                  APInt constIntAP = CI->getValue();
                  char constCharSign = (constIntAP.isNegative()) ? 'n' :
'p';
                  //int constValue = abs(CI->getSExtValue());

Thanks.

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.
>
> 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?
>
> Thanks.
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20121116/172c8c84/attachment.html>


More information about the llvm-dev mailing list