This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH, AArch64, PR 61483] builtin va_start incorrectly initializes the field of va_list for incoming unnamed arguments on the stack


Hi,

The patch fixes a bug in the AArch64 backend in calculating the beginning address of the unnamed incoming arguments on the stack, i.e. the initial value of __va_list->__stack. aarch64_layout_arg incorrectly calculates the size of named arguments on stack using the number of registers needed as if there were enough registers available. This is wrong, as for instance when passed in registers an HFA/HVA* argument takes as many SIMD registers as the number of its fields; when passed on the stack, however, it should be passed as what its storage layout is (rounded to the nearest multiple of 8 bytes).

The bug only affects builtin va_start, as it is other routines like aarch64_pad_arg_upward rather than aarch64_layout_arg which take care of the positioning of outgoing arguments on stack and the fetching of the incoming named arguments from stack.

The patch has passed bootstrapping.

OK for the trunk and 4.9.1 branch once the regtest passes as well?

Thanks,
Yufeng

* HFA: Homogeneous Floating-point Aggregate
  HVA: Homogeneous Short-Vector Aggregate


gcc/

	PR target/61483
	* config/aarch64/aarch64.c (aarch64_layout_arg): Add new local
	variable 'size'; calculate 'size' right in the front; use
	'size' to compute 'nregs' (when 'allocate_ncrn != 0') and
	pcum->aapcs_stack_words.

gcc/testsuite/

	PR target/61483
	* gcc.target/aarch64/aapcs64/type-def.h (struct hfa_fx2_t): New type.
	* gcc.target/aarch64/aapcs64/va_arg-13.c: New test.
	* gcc.target/aarch64/aapcs64/va_arg-14.c: Ditto.
	* gcc.target/aarch64/aapcs64/va_arg-15.c: Ditto.

Attachment: patch
Description: Text document


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]