-
Notifications
You must be signed in to change notification settings - Fork 13.5k
Closed
Labels
C-bugCategory: This is a bug.Category: This is a bug.E-needs-testCall for participation: An issue has been fixed and does not reproduce, but no test has been added.Call for participation: An issue has been fixed and does not reproduce, but no test has been added.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.
Description
Given this Rust code:
#[repr(C)]
struct S {
f1: i32,
f2: i32,
f3: i32,
}
extern {
fn foo(s: S);
}
A call to foo()
generates IR like this on x86_64 Linux:
%S = type { i32, i32, i32 }
; ...
%arg = alloca %S
; ...
%2 = bitcast %S* %s to i8*
%3 = bitcast %S* %arg to i8*
call void @llvm.memcpy.p0i8.p0i8.i64(i8* %3, i8* %2, i64 12, i32 4, i1 false)
%4 = bitcast %S* %arg to { i64, i64 }*
%5 = load { i64, i64 }, { i64, i64 }* %4
call void @x({ i64, i64 } %5)
So we have a 12 byte alloca from which we then read 16 bytes.
Metadata
Metadata
Assignees
Labels
C-bugCategory: This is a bug.Category: This is a bug.E-needs-testCall for participation: An issue has been fixed and does not reproduce, but no test has been added.Call for participation: An issue has been fixed and does not reproduce, but no test has been added.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.