From a5fbc2f36a291cbe80c4393950d6db9b56a34b05 Mon Sep 17 00:00:00 2001 From: Paul Thomas Date: Thu, 1 Nov 2018 19:36:08 +0000 Subject: re PR fortran/40196 ([F03] [F08] Type parameter inquiry (str%len, a%kind) and Complex parts (z%re, z%im)) 2018-11-01 Paul Thomas PR fortran/40196 * dependency.c (are_identical_variables): Return false if the inquiry refs are not the same. (gfc_ref_needs_temporary_p): Break on an inquiry ref. * dump_parse_tree.c (show_ref): Show the inquiry ref type. * expr.c (gfc_free_ref_list): Break on an inquiry ref. (gfc_copy_ref): Copy the inquiry ref types. (find_inquiry_ref): New function. (simplify_const_ref, simplify_ref_chain): Call it. Add new arg to simplify_ref_chain. (gfc_simplify_expr): Use the new arg in call to simplify_ref_chain. (gfc_get_full_arrayspec_from_expr, gfc_is_coarray): Break on inquiry ref. (gfc_traverse_expr): Return true for inquiry ref. * frontend-passes.c (gfc_expr_walker): Break on inquiry ref. * gfortran.h : Add enums and union member in gfc_ref to implement inquiry refs. * intrinsic.c : Fix white nois. * match.c (gfc_match_assignment): A constant lavlue is an error. * module.c : Add DECL_MIO_NAME for inquiry_type and the mstring for inquiry_types. (mio_ref): Handle inquiry refs. * primary.c (is_inquiry_ref): New function. (gfc_match_varspec): Handle inquiry refs calling new function. (gfc_variable_attr): Detect inquiry ref for disambiguation with components. (caf_variable_attr): Treat inquiry and substring refs in the same way. * resolve.c (find_array_spec): ditto. (gfc_resolve_substring_charlen): If there is neither a charlen ref not an inquiry ref, return. (resolve_ref): Handle inqiry refs as appropriate. (resolve_allocate_expr): Entities with an inquiry ref cannot be allocated. * simplify.c (simplify_bound, simplify_cobound): Punt on inquiry refs. * trans-array.c (get_array_ctor_var_strlen): Break on inquiry ref. *trans-expr.c (conv_inquiry): New function. (gfc_conv_variable): Retain the last typespec to pass to conv_inquiry on detecting an inquiry ref. 2018-11-01 Paul Thomas PR fortran/40196 * gfortran.dg/inquiry_part_ref_1.f08: New test. * gfortran.dg/inquiry_part_ref_2.f90: New test. * gfortran.dg/inquiry_part_ref_3.f90: New test. From-SVN: r265729 --- gcc/fortran/resolve.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'gcc/fortran/resolve.c') diff --git a/gcc/fortran/resolve.c b/gcc/fortran/resolve.c index 7ec9e96..ba96234 100644 --- a/gcc/fortran/resolve.c +++ b/gcc/fortran/resolve.c @@ -4740,6 +4740,7 @@ find_array_spec (gfc_expr *e) break; case REF_SUBSTRING: + case REF_INQUIRY: break; } @@ -4962,13 +4963,13 @@ gfc_resolve_substring_charlen (gfc_expr *e) for (char_ref = e->ref; char_ref; char_ref = char_ref->next) { - if (char_ref->type == REF_SUBSTRING) - break; + if (char_ref->type == REF_SUBSTRING || char_ref->type == REF_INQUIRY) + break; if (char_ref->type == REF_COMPONENT) ts = &char_ref->u.c.component->ts; } - if (!char_ref) + if (!char_ref || char_ref->type == REF_INQUIRY) return; gcc_assert (char_ref->next == NULL); @@ -5056,6 +5057,7 @@ resolve_ref (gfc_expr *expr) break; case REF_COMPONENT: + case REF_INQUIRY: break; case REF_SUBSTRING: @@ -5129,6 +5131,7 @@ resolve_ref (gfc_expr *expr) break; case REF_SUBSTRING: + case REF_INQUIRY: break; } @@ -7233,6 +7236,7 @@ resolve_deallocate_expr (gfc_expr *e) break; case REF_SUBSTRING: + case REF_INQUIRY: allocatable = 0; break; } @@ -7525,6 +7529,7 @@ resolve_allocate_expr (gfc_expr *e, gfc_code *code, bool *array_alloc_wo_spec) break; case REF_SUBSTRING: + case REF_INQUIRY: allocatable = 0; pointer = 0; break; -- cgit v1.1