[LLVMdev] bug in llvm-gcc implementation of long long

Rafael EspĂ­ndola rafael.espindola at gmail.com
Mon Sep 4 10:10:01 PDT 2006


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



More information about the llvm-dev mailing list