[LLVMbugs] [Bug 268] NEW: llvm-gcc generates incorrect values for pointer subtraction

bugzilla-daemon at cs.uiuc.edu bugzilla-daemon at cs.uiuc.edu
Tue Mar 2 10:51:33 PST 2004


           Summary: llvm-gcc generates incorrect values for pointer
           Product: tools
           Version: trunk
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P2
         Component: llvm-gcc
        AssignedTo: unassignedbugs at nondot.org
        ReportedBy: criswell at uiuc.edu

The llvm-gcc program mis-compiles certain pointer arithmetic expressions. 
Namely, it seems to generate incorrect LLVM code for expressions which subtract
from pointer values.

The attached C and corresponding LLVM code demonstrate the problem: The expression:

argv[0] - 5


%tmp.3 = getelementptr sbyte* %tmp.2, long 4294967291    ; ty=sbyte*

Note that the -5 is represented as an unsigned number (4294967291).  This might
work, except that long's in LLVM are 64 bits and are translated as such in the
CBE and LLC.

This causes the hbd program to segfault under certain conditions, and it might
be causing other subtle failures in other programs.

------- 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