aboutsummaryrefslogtreecommitdiff
path: root/gcc/fortran/trans-decl.c
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2020-02-01 10:02:20 +0100
committerJakub Jelinek <jakub@redhat.com>2020-02-01 10:02:20 +0100
commitadd31061ec23e07fdf749dc335308efc81151a3d (patch)
treeb12aa90f1e67cd33d919ef010217f6dca5a995a9 /gcc/fortran/trans-decl.c
parent2d33dcfe9f0494c9b56a8d704c3d27c5a4329ebc (diff)
downloadgcc-add31061ec23e07fdf749dc335308efc81151a3d.zip
gcc-add31061ec23e07fdf749dc335308efc81151a3d.tar.gz
gcc-add31061ec23e07fdf749dc335308efc81151a3d.tar.bz2
fortran: Fix up TYPE_ARG_TYPES of procs with scalar VALUE optional args [PR92305]
The following patch fixes -FAIL: libgomp.fortran/use_device_addr-1.f90 -O0 execution test -FAIL: libgomp.fortran/use_device_addr-2.f90 -O0 execution test that has been FAILing for several months on powerpc64le-linux. The problem is in the Fortran FE, which adds the artificial arguments for scalar VALUE OPTIONAL dummy args only to DECL_ARGUMENTS where the current function can see them, but not to TYPE_ARG_TYPES; if those functions aren't varargs, this confuses calls.c to pass the remaining arguments (which aren't named (== not covered by TYPE_ARG_TYPES) and aren't varargs either) in a different spot from what the callee (which has proper DECL_ARGUMENTS for all args) expects. For the artificial length arguments for character dummy args we already put them in both DECL_ARGUMENTS and TYPE_ARG_TYPES. 2020-02-01 Jakub Jelinek <jakub@redhat.com> PR fortran/92305 * trans-types.c (gfc_get_function_type): Also push boolean_type_node types for non-character scalar VALUE optional dummy arguments. * trans-decl.c (create_function_arglist): Skip those in hidden_typelist. Formatting fix.
Diffstat (limited to 'gcc/fortran/trans-decl.c')
-rw-r--r--gcc/fortran/trans-decl.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/gcc/fortran/trans-decl.c b/gcc/fortran/trans-decl.c
index 1147c24..e91a279 100644
--- a/gcc/fortran/trans-decl.c
+++ b/gcc/fortran/trans-decl.c
@@ -2645,8 +2645,8 @@ create_function_arglist (gfc_symbol * sym)
|| f->sym->ts.u.cl->backend_decl == length)
{
if (POINTER_TYPE_P (len_type))
- f->sym->ts.u.cl->backend_decl =
- build_fold_indirect_ref_loc (input_location, length);
+ f->sym->ts.u.cl->backend_decl
+ = build_fold_indirect_ref_loc (input_location, length);
else if (f->sym->ts.u.cl->backend_decl == NULL)
gfc_create_string_length (f->sym);
@@ -2677,6 +2677,8 @@ create_function_arglist (gfc_symbol * sym)
DECL_ARG_TYPE (tmp) = boolean_type_node;
TREE_READONLY (tmp) = 1;
gfc_finish_decl (tmp);
+
+ hidden_typelist = TREE_CHAIN (hidden_typelist);
}
/* For non-constant length array arguments, make sure they use