[LLVMbugs] [Bug 5105] New: -O2 causes llvm/ clang to truncate the value passed to malloc

bugzilla-daemon at cs.uiuc.edu bugzilla-daemon at cs.uiuc.edu
Wed Sep 30 04:54:24 PDT 2009


           Summary: -O2 causes llvm/clang to truncate the value passed to
           Product: clang
           Version: unspecified
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: critical
          Priority: P2
         Component: LLVM Codegen
        AssignedTo: unassignedclangbugs at nondot.org
        ReportedBy: js-llvm-bugzilla at webkeks.org
                CC: llvmbugs at cs.uiuc.edu

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.

More information about the llvm-bugs mailing list