[LLVMbugs] [Bug 1679] New: GEP is unsigned

bugzilla-daemon at cs.uiuc.edu bugzilla-daemon at cs.uiuc.edu
Tue Sep 18 12:07:42 PDT 2007


http://llvm.org/bugs/show_bug.cgi?id=1679

           Summary: GEP is unsigned
           Product: libraries
           Version: trunk
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Backend: C
        AssignedTo: unassignedbugs at nondot.org
        ReportedBy: stein at ir.iit.edu
                CC: llvmbugs at cs.uiuc.edu


The C generated for:
%head.3 = getelementptr i8* %head.2, i32 -1
is:
llvm_cbe_head_3 = &llvm_cbe_head_2[((unsigned int )-1)];
Which is incorrect, due to signedness.
It should be:
llvm_cbe_head_3 = &llvm_cbe_head_2[((int )-1)];

This way instead of having:
$1 = (unsigned char *) 0x10060d016 <Address 0x10060d016 out of bounds>
I could have
$1 = (unsigned char *) 0x60d016 ""

This problem was noticed on AMD64,
so the pointer is 64-bit instead of 32-bit,
thus there was an extra 1 to be added from an unsigned addition.


-- 
Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.



More information about the llvm-bugs mailing list