[LLVMbugs] [Bug 164] [llvmgcc] C front-end miscompiles float constants on big-endian 32-bit target

bugzilla-daemon at cs.uiuc.edu bugzilla-daemon at cs.uiuc.edu
Thu Jan 29 16:10:06 PST 2004


http://llvm.cs.uiuc.edu/bugs/show_bug.cgi?id=164

mkahl at apple.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |REOPENED
         Resolution|INVALID                     |



------- Additional Comments From mkahl at apple.com  2004-01-29 18:10 -------
The above-mentioned test does indeed fail on MacOSX.  Both the float and double arguments are 
incorrect.  From the disassembled IR:

        call void (short, float, sbyte, long, int, double)* %testfunc(short 12, float 0x200000000045D25C, 
sbyte 120, long 123456677890, int -10, double 0xCAFA80000045D25C)

In other experiments, I've found that ALL floats and doubles end in "0045D25C"!  I can't decode IEEE 
floating-point in my head (any more :-), but that's surely wrong.  Even 0.0 doesn't come out all-bits-
zero.

It is even easy to create invalid bytecode files!  I've attached a very short source file, "minus.c".  Here is 
what happens:

        [hatter:~/Work/llvm/test] % llvm-gcc -c minus.c

        [hatter:~/Work/llvm/test] % opt -print minus.o
        /Volumes/Users/mkahl/Work/llvm/llvm/lib/Bytecode/Reader/Reader.cpp:95: failed assertion `(!
isa<Constant>(Val) || !cast<Constant>(Val)->isNullValue()) || !hasImplicitNull(type, 
hasExplicitPrimitiveZeros) && "Cannot read null values from bytecode!"'
        Abort trap

I've also attached "minus.o", in case that helps.




------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.



More information about the llvm-bugs mailing list