[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


           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); }

-quiet -O1 -emit-llvm x.c && cat x.s
; ModuleID = 'x.c'
target datalayout =
target triple = "i686-pc-linux-gnu"

define i8* @f(i8* %p) nounwind  {
        %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