From 8532a010b68c33716346bbd9f253fa51392bf4d1 Mon Sep 17 00:00:00 2001 From: Paul Thomas Date: Sun, 12 Aug 2018 10:55:13 +0000 Subject: [PATCH] re PR fortran/86906 (erroneous name clash with renaming in use statement) 2018-08-12 Paul Thomas PR fortran/86906 * resolve.c (resolve_fl_variable_derived): Check if the derived type is use associated before checking for the host association error. 2018-08-12 Paul Thomas PR fortran/86906 * gfortran.dg/use_rename_9.f90: New test. From-SVN: r263494 --- gcc/fortran/ChangeLog | 7 +++++++ gcc/fortran/resolve.c | 1 + gcc/testsuite/ChangeLog | 5 +++++ gcc/testsuite/gfortran.dg/use_rename_9.f90 | 19 +++++++++++++++++++ 4 files changed, 32 insertions(+) create mode 100644 gcc/testsuite/gfortran.dg/use_rename_9.f90 diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index 26ff7847f86..2d9c1f0ce57 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,3 +1,10 @@ +2018-08-12 Paul Thomas + + PR fortran/86906 + * resolve.c (resolve_fl_variable_derived): Check if the derived + type is use associated before checking for the host association + error. + 2018-08-10 Janus Weil PR fortran/57160 diff --git a/gcc/fortran/resolve.c b/gcc/fortran/resolve.c index 16146e6b6e9..d65118dfae3 100644 --- a/gcc/fortran/resolve.c +++ b/gcc/fortran/resolve.c @@ -12131,6 +12131,7 @@ resolve_fl_variable_derived (gfc_symbol *sym, int no_init_flag) namespace. 14.6.1.3 of the standard and the discussion on comp.lang.fortran. */ if (sym->ns != sym->ts.u.derived->ns + && !sym->ts.u.derived->attr.use_assoc && sym->ns->proc_name->attr.if_source != IFSRC_IFBODY) { gfc_symbol *s; diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 38c33299879..bced6d37d84 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2018-08-12 Paul Thomas + + PR fortran/86906 + * gfortran.dg/use_rename_9.f90: New test. + 2018-08-11 Jakub Jelinek PR tree-optimization/86835 diff --git a/gcc/testsuite/gfortran.dg/use_rename_9.f90 b/gcc/testsuite/gfortran.dg/use_rename_9.f90 new file mode 100644 index 00000000000..a26df9e23d2 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/use_rename_9.f90 @@ -0,0 +1,19 @@ +! { dg-do compile } +! +! Test the fix for PR86906, in which a spurious error was generated +! by 'config' in the subroutine having the same symbol name as the +! renamed 'foo_config'. +! +! Contributed by Damian Rouson +! +module foo + type config + end type +end module + use foo, only: foo_config => config +contains + subroutine cap + integer config + type(foo_config) extra + end subroutine +end -- 2.30.2