]> gcc.gnu.org Git - gcc.git/commit
rs6000: Fix up setup_incoming_varargs [PR114175]
authorJakub Jelinek <jakub@redhat.com>
Tue, 19 Mar 2024 08:13:32 +0000 (09:13 +0100)
committerJakub Jelinek <jakub@redhat.com>
Tue, 19 Mar 2024 08:13:32 +0000 (09:13 +0100)
commit8f85b46337f90c3126b9cefd72ffd29eb9a4ebf3
tree1f5071ccba70038dd5558be9a2acfb7968ebfbc4
parent8959ab63f1881a8a4b1921b946d4ea3986bf1063
rs6000: Fix up setup_incoming_varargs [PR114175]

The c23-stdarg-8.c test (as well as the new test below added to cover even
more cases) FAIL on powerpc64le-linux and presumably other powerpc* targets
as well.
Like in the r14-9503-g218d174961 change on x86-64 we need to advance
next_cum after the hidden return pointer argument even in case where
there are no user arguments before ... in C23.
The following patch does that.

There is another TYPE_NO_NAMED_ARGS_STDARG_P use later on:
      if (!TYPE_NO_NAMED_ARGS_STDARG_P (TREE_TYPE (current_function_decl))
          && targetm.calls.must_pass_in_stack (arg))
        first_reg_offset += rs6000_arg_size (TYPE_MODE (arg.type), arg.type);
but I believe it was added there in r13-3549-g4fe34cdc unnecessarily,
when there is no hidden return pointer argument, arg.type is NULL and
must_pass_in_stack_var_size as well as must_pass_in_stack_var_size_or_pad
return false in that case, and for the TYPE_NO_NAMED_ARGS_STDARG_P
case with hidden return pointer argument that argument should have pointer
type and it is the first argument, so must_pass_in_stack shouldn't be true
for it either.

2024-03-19  Jakub Jelinek  <jakub@redhat.com>

PR target/114175
* config/rs6000/rs6000-call.cc (setup_incoming_varargs): Only skip
rs6000_function_arg_advance_1 for TYPE_NO_NAMED_ARGS_STDARG_P functions
if arg.type is NULL.

* gcc.dg/c23-stdarg-9.c: New test.
gcc/config/rs6000/rs6000-call.cc
gcc/testsuite/gcc.dg/c23-stdarg-9.c [new file with mode: 0644]
This page took 0.068743 seconds and 5 git commands to generate.