diff options
author | Jakub Jelinek <jakub@redhat.com> | 2023-01-09 13:36:22 +0100 |
---|---|---|
committer | Jakub Jelinek <jakub@redhat.com> | 2023-01-09 13:36:22 +0100 |
commit | b1879fb84e78fa2c530e66de43f3dc125820864a (patch) | |
tree | 0cb43d633226c392c91dc314e9b68152c09c74e1 /gcc/ada/libgnat/g-cppexc.adb | |
parent | a5a8242153d078f1ebe60f00409415da260a29ee (diff) | |
download | gcc-b1879fb84e78fa2c530e66de43f3dc125820864a.zip gcc-b1879fb84e78fa2c530e66de43f3dc125820864a.tar.gz gcc-b1879fb84e78fa2c530e66de43f3dc125820864a.tar.bz2 |
calls: Fix up TYPE_NO_NAMED_ARGS_STDARG_P handling [PR107453]
On powerpc64le-linux, the following patch fixes
-FAIL: gcc.dg/c2x-stdarg-4.c execution test
-FAIL: gcc.dg/torture/c2x-stdarg-split-1a.c -O0 execution test
-FAIL: gcc.dg/torture/c2x-stdarg-split-1a.c -O1 execution test
-FAIL: gcc.dg/torture/c2x-stdarg-split-1a.c -O2 execution test
-FAIL: gcc.dg/torture/c2x-stdarg-split-1a.c -O2 -flto -fno-use-linker-plugin -flto-partition=none execution test
-FAIL: gcc.dg/torture/c2x-stdarg-split-1a.c -O2 -flto -fuse-linker-plugin -fno-fat-lto-objects execution test
-FAIL: gcc.dg/torture/c2x-stdarg-split-1a.c -O3 -g execution test
-FAIL: gcc.dg/torture/c2x-stdarg-split-1a.c -Os execution test
The problem is mismatch between the caller and callee side.
On the callee side, we do:
/* NAMED_ARG is a misnomer. We really mean 'non-variadic'. */
if (!cfun->stdarg)
data->arg.named = 1; /* No variadic parms. */
else if (DECL_CHAIN (parm))
data->arg.named = 1; /* Not the last non-variadic parm. */
else if (targetm.calls.strict_argument_naming (all->args_so_far))
data->arg.named = 1; /* Only variadic ones are unnamed. */
else
data->arg.named = 0; /* Treat as variadic. */
which is later passed to the target hooks to determine if a particular
argument is named or not. Now, cfun->stdarg is determined from the stdarg_p
call, which for the new C2X TYPE_NO_NAMED_ARGS_STDARG_P function types
(rettype fn (...)) returns true. Such functions have no named arguments,
so data->arg.named will be 0 in function.cc. But on the caller side,
as TYPE_NO_NAMED_ARGS_STDARG_P function types have TYPE_ARG_TYPES NULL,
we instead treat those calls as unprototyped even when they are prototyped
- /* If we know nothing, treat all args as named. */ n_named_args = num_actuals;
in 2 spots. We need to treat the TYPE_NO_NAMED_ARGS_STDARG_P cases as
prototyped with no named arguments.
2023-01-09 Jakub Jelinek <jakub@redhat.com>
PR target/107453
* calls.cc (expand_call): For calls with
TYPE_NO_NAMED_ARGS_STDARG_P (funtype) use zero for n_named_args.
Formatting fix.
Diffstat (limited to 'gcc/ada/libgnat/g-cppexc.adb')
0 files changed, 0 insertions, 0 deletions