[LLVMbugs] [Bug 1603] New: llvm-gcc miscompiles illegal assignment to const ptr

bugzilla-daemon at cs.uiuc.edu bugzilla-daemon at cs.uiuc.edu
Thu Aug 9 18:08:55 PDT 2007


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

           Summary: llvm-gcc miscompiles illegal assignment to const ptr
           Product: tools
           Version: trunk
          Platform: PC
        OS/Version: Windows XP
            Status: NEW
          Severity: normal
          Priority: P2
         Component: llvm-gcc
        AssignedTo: unassignedbugs at nondot.org
        ReportedBy: patil.nikhil at gmail.com
                CC: llvmbugs at cs.uiuc.edu


I don't know if this is in upstream gcc or llvm-gcc4.

int func()
{
   const int *arr;
   arr[0] = 1;
}

$ llvm-gcc main.c -c; echo $?
0

$ gcc main.c -c
main.c: In function 'func':
main.c:4: error: assignment of read-only location

The difference disappears when arr[0] is replaced by *arr.

(I tried the above with gcc 4.1.2, 3.4.6, 4.0.3. (I don't have access
to 4.0.1, off which llvm-gcc seems to be derived.)


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