From b9a21efdea18862f79c68ceb2eee0704844ead53 Mon Sep 17 00:00:00 2001 From: "Steven G. Kargl" Date: Sat, 17 Aug 2019 17:15:42 +0000 Subject: re PR fortran/82992 (ICE in create_int_parameter_array, at fortran/module.c:6586) 2019-08-17 Steven G. Kargl PR fortran/82992 * module.c (gfc_match_use): When renaming a module entity, search current namespace for conflicting symbol. 2019-08-17 Steven G. Kargl PR fortran/82992 * gfortran.dg/pr71649.f90: Adjust error messages. * gfortran.dg/use_15.f90: Ditto. * gfortran.dg/use_rename_8.f90: Ditto. From-SVN: r274608 --- gcc/fortran/ChangeLog | 6 ++++++ gcc/fortran/module.c | 16 ++++++++++++++++ 2 files changed, 22 insertions(+) (limited to 'gcc/fortran') diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index 21593de..9af5836 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,5 +1,11 @@ 2019-08-17 Steven G. Kargl + PR fortran/82992 + * module.c (gfc_match_use): When renaming a module entity, search + current namespace for conflicting symbol. + +2019-08-17 Steven G. Kargl + PR fortran/78739 * match.c (gfc_match_st_function): When matching a statement function, need to check if the statement function name shadows the function diff --git a/gcc/fortran/module.c b/gcc/fortran/module.c index 9c8ae13..fb6173d 100644 --- a/gcc/fortran/module.c +++ b/gcc/fortran/module.c @@ -525,6 +525,8 @@ gfc_match_use (void) gfc_intrinsic_op op; match m; gfc_use_list *use_list; + gfc_symtree *st; + locus loc; use_list = gfc_get_use_list (); @@ -632,6 +634,8 @@ gfc_match_use (void) case INTERFACE_USER_OP: case INTERFACE_GENERIC: case INTERFACE_DTIO: + loc = gfc_current_locus; + m = gfc_match (" =>"); if (type == INTERFACE_USER_OP && m == MATCH_YES @@ -642,6 +646,18 @@ gfc_match_use (void) if (type == INTERFACE_USER_OP) new_use->op = INTRINSIC_USER; + st = gfc_find_symtree (gfc_current_ns->sym_root, name); + if (st) + { + if (m == MATCH_YES) + gfc_error ("Symbol %qs at %L conflicts with the rename symbol " + "at %L", name, &st->n.sym->declared_at, &loc); + else + gfc_error ("Symbol %qs at %L conflicts with the symbol " + "at %L", name, &st->n.sym->declared_at, &loc); + goto cleanup; + } + if (use_list->only_flag) { if (m != MATCH_YES) -- cgit v1.1