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/eee9499a/attachment.html>
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
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>
Eli, Thanks for responding. Yes, I read the error message but it seems odd that it would be trying to use more than 64 bits. It compiles and executes in gcc on 32 bit arch just fine. I'll probably take your suggestion and file a bug with a reduced testcase. Thanks again, Ryan On Fri, Nov 16, 2012 at 3:10 PM, Eli Friedman <eli.friedman at gmail.com>wrote:> 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 >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20121116/b346a764/attachment.html>
So is there a way to return the value as a string instead? 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/20121204/8269890f/attachment.html>
On 12/4/2012 12:56 PM, Ryan Taylor wrote:> So is there a way to return the value as a string instead? >There are several ways: include/llvm/ADT/APInt.h /// toString - Converts an APInt to a string and append it to Str. Str is /// commonly a SmallString. void toString(SmallVectorImpl<char> &Str, unsigned Radix, bool Signed, bool formatAsCLiteral = false) const; /// Considers the APInt to be unsigned and converts it into a string in the /// radix given. The radix can be 2, 8, 10 16, or 36. void toStringUnsigned(SmallVectorImpl<char> &Str, unsigned Radix = 10) const { toString(Str, Radix, false, false); } /// Considers the APInt to be signed and converts it into a string in the /// radix given. The radix can be 2, 8, 10, 16, or 36. void toStringSigned(SmallVectorImpl<char> &Str, unsigned Radix = 10) const { toString(Str, Radix, true, false); } /// toString - This returns the APInt as a std::string. Note that this is an /// inefficient method. It is better to pass in a SmallVector/SmallString /// to the methods above to avoid thrashing the heap for the string. std::string toString(unsigned Radix, bool Signed) const; -Krzysztof -- Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted by The Linux Foundation