[LLVMbugs] [Bug 2781] can't add 8 to a void * pointer
bugzilla-daemon at cs.uiuc.edu
bugzilla-daemon at cs.uiuc.edu
Tue Sep 9 10:57:51 PDT 2008
http://llvm.org/bugs/show_bug.cgi?id=2781
Bill Wendling <wendling at apple.com> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |wendling at apple.com
Status|NEW |RESOLVED
Resolution| |WORKSFORME
--- Comment #4 from Bill Wendling <wendling at apple.com> 2008-09-09 12:57:49 ---
(In reply to comment #3)
> Yes. This was reduced from a more complicated example which, given an arbitrary
> pointer p, did something like:
>
> printf("%p %p\n", p, f(p));
>
> and the numbers printed differed by 1, not by 8.
>
When I compile this code:
#include <stdio.h>
void *f(void *p) __attribute__((noinline));
void *f(void *p) {
return (void*)((int)p + 8);
}
int main(int argc, char **argv) {
printf("%p %p\n", argv, f(argv));
}
I get this:
define i8* @f(i8* %p) nounwind notes(inline=never) {
entry:
%0 = getelementptr i8* %p, i32 8 ; <i8*> [#uses=1]
ret i8* %0
}
define i32 @main(i32 %argc, i8** %argv) nounwind {
...
}
with top of tree. Please use top-of-tree.
--
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