re PR fortran/82173 ([meta-bug] Parameterized derived type errors)
authorPaul Thomas <pault@gcc.gnu.org>
Tue, 12 Sep 2017 18:06:52 +0000 (18:06 +0000)
committerPaul Thomas <pault@gcc.gnu.org>
Tue, 12 Sep 2017 18:06:52 +0000 (18:06 +0000)
commit18a4e7e305c1e12392ac35073b89f2ca0e7f8eda
tree35868a7bbccbfde8c2a0a0a67d0e69c9c17b1d6c
parent29788f907095044876531d7b4df154ad8398f854
re PR fortran/82173 ([meta-bug] Parameterized derived type errors)

2017-09-12  Paul Thomas  <pault@gcc.gnu.org>

PR fortran/82173
PR fortran/82168
* decl.c (variable_decl): Check pdt template components for
appearance of KIND/LEN components in the type parameter name
list, that components corresponding to type parameters have
either KIND or LEN attributes and that KIND or LEN components
are scalar. Copy the initializer to the parameter value.
(gfc_get_pdt_instance): Add a label 'error_return' and follow
it with repeated code, while replacing this code with a jump.
Check if a parameter appears as a component in the template.
Make sure that the parameter expressions are integer. Validate
KIND expressions.
(gfc_match_decl_type_spec): Search for pdt_types in the parent
namespace since they are instantiated in the template ns.
* expr.c (gfc_extract_int): Use a KIND parameter if it
appears as a component expression.
(gfc_check_init_expr): Allow expressions with the pdt_kind
attribute.
*primary.c (gfc_match_actual_arglist): Make sure that the first
keyword argument is recognised when 'pdt' is set.

2017-09-12  Paul Thomas  <pault@gcc.gnu.org>

PR fortran/82173
* gfortran.dg/pdt_4.f03 : Remove the 'is being used before it
is defined' error.
* gfortran.dg/pdt_6.f03 : New test.
* gfortran.dg/pdt_7.f03 : New test.
* gfortran.dg/pdt_8.f03 : New test.

PR fortran/82168
* gfortran.dg/pdt_9.f03 : New test.

From-SVN: r252039
gcc/fortran/ChangeLog
gcc/fortran/decl.c
gcc/fortran/expr.c
gcc/fortran/primary.c
gcc/fortran/symbol.c
gcc/testsuite/ChangeLog
gcc/testsuite/gfortran.dg/pdt_4.f03
gcc/testsuite/gfortran.dg/pdt_6.f03 [new file with mode: 0644]
gcc/testsuite/gfortran.dg/pdt_7.f03 [new file with mode: 0644]
gcc/testsuite/gfortran.dg/pdt_8.f03 [new file with mode: 0644]
gcc/testsuite/gfortran.dg/pdt_9.f03 [new file with mode: 0644]