[RFC][PATCH][AArch64] Cleanup frame pointer usage
Wilco Dijkstra
Wilco.Dijkstra@arm.com
Thu Jun 15 17:43:00 GMT 2017
Jiong Wang wrote:
test.c
===
struct K {
int a;
int b;
int c;
int d;
char e;
short f;
long g;
float h;
double i;
};
void foo (int, struct K *);
void test (int i)
{
struct K k = {
.a = 5,
.b = 0,
.c = i,
};
foo (5, &k);
}
There are 2 separate latent bugs here, both unrelated to this patch. If I build with -fomit-frame pointer I get:
str x30, [sp, -64]!
mov w2, 5
mov x1, sp
str w2, [sp, 16]
add x1, x1, 20
stp xzr, xzr, [x1]
add x1, sp, 16
str w0, [sp, 24]
mov x0, sp
add x0, x0, 36
stp xzr, xzr, [x0]
mov w0, w2
str xzr, [sp, 52]
str wzr, [sp, 60]
bl foo
ldr x30, [sp], 64
ret
If I use a compiler from early January (which also includes my patch) I get:
str x30, [sp, -64]!
mov w2, 5
stp xzr, xzr, [sp, 16]
add x1, sp, 16
str w0, [sp, 24]
mov w0, w2
stp xzr, xzr, [sp, 32]
stp xzr, xzr, [sp, 48]
str w2, [sp, 16]
bl foo
ldr x30, [sp], 64
ret
Clearly a nasty regression was introduced in the structure initialization code...
Wilco
More information about the Gcc-patches
mailing list