diff options
author | Paul Thomas <pault@gcc.gnu.org> | 2017-10-07 21:14:06 +0000 |
---|---|---|
committer | Paul Thomas <pault@gcc.gnu.org> | 2017-10-07 21:14:06 +0000 |
commit | 2fcd5884177d490c5cdc36464bd6b0a3bc4e8d54 (patch) | |
tree | f35dd21ab87d1b52f109109851b7511d6da2144c /gcc/fortran/module.c | |
parent | 12b9f3ac928e1ed7e3aa92cab42beb6317b27981 (diff) | |
download | gcc-2fcd5884177d490c5cdc36464bd6b0a3bc4e8d54.zip gcc-2fcd5884177d490c5cdc36464bd6b0a3bc4e8d54.tar.gz gcc-2fcd5884177d490c5cdc36464bd6b0a3bc4e8d54.tar.bz2 |
re PR fortran/82375 (PDT components in PDT declarations fail to compile)
2017-10-07 Paul Thomas <pault@gcc.gnu.org>
PR fortran/82375
* class.c (gfc_find_derived_vtab): Return NULL for a passed
pdt template to prevent bad procedures from being written.
* decl.c (gfc_get_pdt_instance): Do not use the default
initializer for pointer and allocatable pdt type components. If
the component is allocatbale, set the 'alloc_comp' attribute of
'instance'.
* module.c : Add a prototype for 'mio_actual_arglist'. Add a
boolean argument 'pdt'.
(mio_component): Call it for the parameter list of pdt type
components with 'pdt' set to true.
(mio_actual_arg): Add the boolean 'pdt' and, if it is set, call
mio_integer for the 'spec_type'.
(mio_actual_arglist): Add the boolean 'pdt' and use it in the
call to mio_actual_arg.
(mio_expr, mio_omp_udr_expr): Call mio_actual_arglist with
'pdt' set false.
* resolve.c (get_pdt_spec_expr): Add the parameter name to the
KIND parameter error.
(get_pdt_constructor): Check that cons->expr is non-null.
* trans-array.c (structure_alloc_comps): For deallocation of
allocatable components, ensure that parameterized components
are deallocated first. Likewise, when parameterized components
are allocated, nullify allocatable components first. Do not
recurse into pointer or allocatable pdt components while
allocating or deallocating parameterized components. Test that
parameterized arrays or strings are allocated before freeing
them.
(gfc_trans_pointer_assignment): Call the new function. Tidy up
a minor whitespace issue.
trans-decl.c (gfc_trans_deferred_vars): Set 'tmp' to NULL_TREE
to prevent the expression from being used a second time.
2017-10-07 Paul Thomas <pault@gcc.gnu.org>
PR fortran/82375
* gfortran.dg/pdt_13.f03 : New test.
* gfortran.dg/pdt_14.f03 : New test.
* gfortran.dg/pdt_15.f03 : New test.
From-SVN: r253514
Diffstat (limited to 'gcc/fortran/module.c')
-rw-r--r-- | gcc/fortran/module.c | 20 |
1 files changed, 13 insertions, 7 deletions
diff --git a/gcc/fortran/module.c b/gcc/fortran/module.c index 63877a0..3f19a02 100644 --- a/gcc/fortran/module.c +++ b/gcc/fortran/module.c @@ -2788,6 +2788,7 @@ mio_component_ref (gfc_component **cp) static void mio_namespace_ref (gfc_namespace **nsp); static void mio_formal_arglist (gfc_formal_arglist **formal); static void mio_typebound_proc (gfc_typebound_proc** proc); +static void mio_actual_arglist (gfc_actual_arglist **ap, bool pdt); static void mio_component (gfc_component *c, int vtype) @@ -2819,6 +2820,9 @@ mio_component (gfc_component *c, int vtype) /* PDT templates store the expression for the kind of a component here. */ mio_expr (&c->kind_expr); + /* PDT types store component specification list here. */ + mio_actual_arglist (&c->param_list, true); + mio_symbol_attribute (&c->attr); if (c->ts.type == BT_CLASS) c->attr.class_ok = 1; @@ -2874,17 +2878,19 @@ mio_component_list (gfc_component **cp, int vtype) static void -mio_actual_arg (gfc_actual_arglist *a) +mio_actual_arg (gfc_actual_arglist *a, bool pdt) { mio_lparen (); mio_pool_string (&a->name); mio_expr (&a->expr); + if (pdt) + mio_integer ((int *)&a->spec_type); mio_rparen (); } static void -mio_actual_arglist (gfc_actual_arglist **ap) +mio_actual_arglist (gfc_actual_arglist **ap, bool pdt) { gfc_actual_arglist *a, *tail; @@ -2893,7 +2899,7 @@ mio_actual_arglist (gfc_actual_arglist **ap) if (iomode == IO_OUTPUT) { for (a = *ap; a; a = a->next) - mio_actual_arg (a); + mio_actual_arg (a, pdt); } else @@ -2913,7 +2919,7 @@ mio_actual_arglist (gfc_actual_arglist **ap) tail->next = a; tail = a; - mio_actual_arg (a); + mio_actual_arg (a, pdt); } } @@ -3538,7 +3544,7 @@ mio_expr (gfc_expr **ep) case EXPR_FUNCTION: mio_symtree_ref (&e->symtree); - mio_actual_arglist (&e->value.function.actual); + mio_actual_arglist (&e->value.function.actual, false); if (iomode == IO_OUTPUT) { @@ -4203,7 +4209,7 @@ mio_omp_udr_expr (gfc_omp_udr *udr, gfc_symbol **sym1, gfc_symbol **sym2, int flag; mio_name (1, omp_declare_reduction_stmt); mio_symtree_ref (&ns->code->symtree); - mio_actual_arglist (&ns->code->ext.actual); + mio_actual_arglist (&ns->code->ext.actual, false); flag = ns->code->resolved_isym != NULL; mio_integer (&flag); @@ -4245,7 +4251,7 @@ mio_omp_udr_expr (gfc_omp_udr *udr, gfc_symbol **sym1, gfc_symbol **sym2, int flag; ns->code = gfc_get_code (EXEC_CALL); mio_symtree_ref (&ns->code->symtree); - mio_actual_arglist (&ns->code->ext.actual); + mio_actual_arglist (&ns->code->ext.actual, false); mio_integer (&flag); if (flag) |