Skip to content

llvm-gcc: x86_64 passing of struct { char a, b, c; } generates invalid read #3785

@llvmbot

Description

@llvmbot
Bugzilla Link 3413
Resolution WONTFIX
Resolved on Jul 29, 2010 17:32
Version unspecified
OS All
Reporter LLVM Bugzilla Contributor

Extended Description

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

--
ddunbar@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 ; [#uses=0]
br label %return

return: ; preds = %entry
%retval1 = bitcast %struct.anon* %retval to i32* ; <i32*> [#uses=1]
%retval2 = load i32* %retval1 ; [#uses=1]
ret i32 %retval2
}

The read is accessing an extra byte after the alloca.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugzillaIssues migrated from bugzillawontfixIssue is real, but we can't or won't fix it. Not invalid

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions