[LLVMbugs] [Bug 2781] New: can't add 8 to a void * pointer

bugzilla-daemon at cs.uiuc.edu bugzilla-daemon at cs.uiuc.edu
Mon Sep 8 08:37:09 PDT 2008


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

           Summary: can't add 8 to a void * pointer
           Product: tools
           Version: 2.2
          Platform: PC
        OS/Version: Windows XP
            Status: NEW
          Severity: normal
          Priority: P2
         Component: llvm-gcc
        AssignedTo: unassignedbugs at nondot.org
        ReportedBy: jay.foad at antixlabs.com
                CC: llvmbugs at cs.uiuc.edu


I get this:

$ cat x.c
void *f(void *p) { return (void *)((int)p + 8); }

$
~/llvm/llvm-gcc4.2-2.2-x86-linux-RHEL4/libexec/gcc/i686-pc-linux-gnu/4.2.1/cc1
-quiet -O1 -emit-llvm x.c && cat x.s
; ModuleID = 'x.c'
target datalayout =
"e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:32:32"
target triple = "i686-pc-linux-gnu"

define i8* @f(i8* %p) nounwind  {
entry:
        %tmp34 = getelementptr i8* %p, i32 1            ; <i8*> [#uses=1]
        ret i8* %tmp34
}

The generated code is adding 1 to the pointer, not 8!


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