[Bug target/61483] New: [AArch64] builtin va_start incorrectly initializes the field of va_list for incoming unnamed arguments on the stack
yufeng at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Thu Jun 12 11:23:00 GMT 2014
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61483
Bug ID: 61483
Summary: [AArch64] builtin va_start incorrectly initializes the
field of va_list for incoming unnamed arguments on the
stack
Product: gcc
Version: 4.8.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: target
Assignee: unassigned at gcc dot gnu.org
Reporter: yufeng at gcc dot gnu.org
The following code is mis-compiled by gcc, when targeting aarch64. The issue is
that the second variadic argument to callee_b0f, which is of type long long, is
not retrieved correctly inside the callee.
------------------- CODE -------------------
#include <stdarg.h>
#include <stdio.h>
struct float_float_t { float a, b; } float_float = {1.2, 2.2};
union float_int_t {
float b8;
int b5;
} float_int = {4983.80};
long long correct = 12683143434LL;
long long callee_b0f(float f1, float f2, float f3, float f4,
float f5, float f6, float f7, struct float_float_t ff,
int i1, int i2, int i3, int i4,
int i5, int i6, int i7,
...) {
va_list ap;
va_start(ap, i7);
va_arg(ap, union float_int_t);
long long var = va_arg(ap, long long);
va_end(ap);
return var;
}
int main()
{
long long check = callee_b0f(1.0, 2.0, 3.0, 4.0,
5.0, 6.0, 7.0, float_float,
9, 10, 11, 12,
13, 14, 15,
float_int, correct);
printf("%lld\n%lld\n", correct, check);
return 0;
}
------------------- CUT -------------------
Expected output:
12683143434
12683143434
Actual output:
12683143434
0
I have checked that this bug is present since 4.8.0 (day one of the aarch64
port).
More information about the Gcc-bugs
mailing list