[LLVMbugs] [Bug 3413] New: llvm-gcc: x86_64 passing of struct { char a, b, c; } generates invalid read

bugzilla-daemon at cs.uiuc.edu bugzilla-daemon at cs.uiuc.edu
Mon Jan 26 11:00:44 PST 2009


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

           Summary: llvm-gcc: x86_64 passing of struct { char a, b, c; }
                    generates invalid read
           Product: new-bugs
           Version: unspecified
          Platform: Macintosh
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: new bugs
        AssignedTo: unassignedbugs at nondot.org
        ReportedBy: daniel at zuster.org
                CC: llvmbugs at cs.uiuc.edu


llvm-gcc generates an out of bounds read when passing struct { char a, b, c; }.

--
ddunbar at ozzy:tmp$ echo 'struct { char a,b,c; } f0() {}' | llvm-gcc -m64 -S
-emit-llvm -o - -x c -

target datalayout =
"e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128"
target triple = "x86_64-apple-darwin10.0"
        %struct.anon = type { i8, i8, i8 }

define i32 @f0() nounwind {
entry:
        %retval = alloca %struct.anon           ; <%struct.anon*> [#uses=1]
        %"alloca point" = bitcast i32 0 to i32          ; <i32> [#uses=0]
        br label %return

return:         ; preds = %entry
        %retval1 = bitcast %struct.anon* %retval to i32*                ;
<i32*> [#uses=1]
        %retval2 = load i32* %retval1           ; <i32> [#uses=1]
        ret i32 %retval2
}
--
The read is accessing an extra byte after the alloca.


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