http://llvm.org/bugs/show_bug.cgi?id=5105
Summary: -O2 causes llvm/clang to truncate the value passed to
malloc
Product: clang
Version: unspecified
Platform: PC
OS/Version: Linux
Status: NEW
Severity: critical
Priority: P2
Component: LLVM Codegen
AssignedTo: [email protected]
ReportedBy: [email protected]
CC: [email protected]
This is on an AMD64 system.
llvm revision: 83146
asgard:/tmp$ cat test.c
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
int main()
{
printf("%p\n", malloc(SIZE_MAX));
return 0;
}
asgard:/tmp$ clang -S test.c -o test.S
asgard:/tmp$ clang -S -O2 test.c -o test.O2.S
asgard:/tmp$ cat test.S
[â¦]
movabsq $-1, %rax
movq %rax, %rdi
call malloc
[â¦]
asgard:/tmp$ cat test.O2.S
[â¦]
movl $4294967295, %edi
call malloc
[â¦]
For some reason, llvm/clang truncates the value to 32 bits if -O2 is specified.
--
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.
_______________________________________________
LLVMbugs mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/llvmbugs