[LLVMbugs] Miscompilation of 2003-05-26-Shorts.c on Sparc

Chris Lattner sabre at nondot.org
Wed Oct 22 11:26:06 PDT 2003


On Wed, 22 Oct 2003, Vikram S. Adve wrote:

> Here are the outputs that get generated.  As I said I assumed bugpoint
> wouldn't help so I didn't investigate beyond that:
> tank:/localhome/vadve/llvm/test/Programs/SingleSource/UnitTests/2003-05-
> 26-Shorts.out-*

It looks like a bug in the native compiler.  This appears to be completely
portable:
unsigned long long getL() {
  return 0xafafafafc5c5b8a3ull;
}
...
  unsigned long long  UL = getL();
  unsigned short us = (unsigned short) UL;
  printf("UL-us = %lld (0x%llx)\n", UL-us, UL-us);
...

The native compiler you are using prints zero for the result of the
subtraction, instead of 0xafafafafc5c50000, like it should.

-Chris

-- 
http://llvm.cs.uiuc.edu/
http://www.nondot.org/~sabre/Projects/




More information about the llvm-bugs mailing list