Rafael Espíndola
2006-Sep-04 17:10 UTC
[LLVMdev] bug in llvm-gcc implementation of long long
Compiling the following C code -------------------------------------------- long long f4(void) { return (long long)INT_MAX + 1; } ------------------------------------------- produces ------------------------------------------ long %f4() { entry: ret long -2147483648 } ------------------------------------------ but in 64 bits, -2147483648 != 2147483648. As a result, the x86 output has eax = 2147483648 edx = 4294967295 the correct output is eax = 2147483648 edx = 0 Best Regards, Rafael
Rafael Espíndola
2006-Sep-04 18:58 UTC
[LLVMdev] bug in llvm-gcc implementation of long long
> What does the preprocessed output of that function look like?long long f4(void) { return (long long)2147483647 + 1; } Using 2147483648LL directly causes the same problem.> -ChrisBest Regards, Rafael
On Mon, 4 Sep 2006, [UTF-8] Rafael Esp?ndola wrote:> Compiling the following C code > ------------------------------------------ > long %f4() { > entry: > ret long -2147483648 > } > ------------------------------------------I get this: long %f4() { entry: ret long 2147483648 } What does the preprocessed output of that function look like? -Chris -- http://nondot.org/sabre/ http://llvm.org/
Rafael Espíndola wrote: > return (long long)INT_MAX + 1; does it work in ordinary gcc? I recall I had a problem with this in an earlier version of gcc, maybe they still haven't fixed it. m.
Rafael Espíndola
2006-Sep-05 10:18 UTC
[LLVMdev] bug in llvm-gcc implementation of long long
> does it work in ordinary gcc? I recall I had a problem with this in an earlier version of gcc, maybe they still haven't > fixed it.Works in vanilla 4.1 Rafael
Rafael Espíndola
2006-Sep-05 13:05 UTC
[LLVMdev] bug in llvm-gcc implementation of long long
> does it work in ordinary gcc? I recall I had a problem with this in an earlier version of gcc, maybe they still haven't > fixed it.I have just compiled revision 102 without --enable-llvm and the resulting code correctly sets edx to 0. Time to try gdb. Rafael
Reasonably Related Threads
- [LLVMdev] bug in llvm-gcc implementation of long long
- [LLVMdev] bug in llvm-gcc implementation of long long
- RFC: A new ABI for virtual calls, and a change to the virtual call representation in the IR
- RFC: A new ABI for virtual calls, and a change to the virtual call representation in the IR
- RFC: A new ABI for virtual calls, and a change to the virtual call representation in the IR