aboutsummaryrefslogtreecommitdiff
path: root/gcc/fortran/class.c
diff options
context:
space:
mode:
authorPaul Thomas <pault@gcc.gnu.org>2017-10-07 21:14:06 +0000
committerPaul Thomas <pault@gcc.gnu.org>2017-10-07 21:14:06 +0000
commit2fcd5884177d490c5cdc36464bd6b0a3bc4e8d54 (patch)
treef35dd21ab87d1b52f109109851b7511d6da2144c /gcc/fortran/class.c
parent12b9f3ac928e1ed7e3aa92cab42beb6317b27981 (diff)
downloadgcc-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/class.c')
-rw-r--r--gcc/fortran/class.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/gcc/fortran/class.c b/gcc/fortran/class.c
index a345d13..ebbd41b 100644
--- a/gcc/fortran/class.c
+++ b/gcc/fortran/class.c
@@ -2211,6 +2211,9 @@ gfc_find_derived_vtab (gfc_symbol *derived)
gfc_gsymbol *gsym = NULL;
gfc_symbol *dealloc = NULL, *arg = NULL;
+ if (derived->attr.pdt_template)
+ return NULL;
+
/* Find the top-level namespace. */
for (ns = gfc_current_ns; ns; ns = ns->parent)
if (!ns->parent)