re PR fortran/86906 (erroneous name clash with renaming in use statement)
authorPaul Thomas <pault@gcc.gnu.org>
Sun, 12 Aug 2018 10:55:13 +0000 (10:55 +0000)
committerPaul Thomas <pault@gcc.gnu.org>
Sun, 12 Aug 2018 10:55:13 +0000 (10:55 +0000)
2018-08-12  Paul Thomas  <pault@gcc.gnu.org>

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  <pault@gcc.gnu.org>

PR fortran/86906
* gfortran.dg/use_rename_9.f90: New test.

From-SVN: r263494

gcc/fortran/ChangeLog
gcc/fortran/resolve.c
gcc/testsuite/ChangeLog
gcc/testsuite/gfortran.dg/use_rename_9.f90 [new file with mode: 0644]

index 26ff7847f86e3e760c9ed9ecff0cc2a2f750f0d2..2d9c1f0ce572337a873201df429f5f5fd1c8d66b 100644 (file)
@@ -1,3 +1,10 @@
+2018-08-12  Paul Thomas  <pault@gcc.gnu.org>
+
+       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  <janus@gcc.gnu.org>
 
        PR fortran/57160
index 16146e6b6e9c38692b5f3dffba23e054c96cc00b..d65118dfae3cf224ecf5811f844d4004aa7845e0 100644 (file)
@@ -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;
index 38c33299879c6a6890cb5fe834a7046d8567d4b9..bced6d37d84979cb04a6d31296070c90ff650c48 100644 (file)
@@ -1,3 +1,8 @@
+2018-08-12  Paul Thomas  <pault@gcc.gnu.org>
+
+       PR fortran/86906
+       * gfortran.dg/use_rename_9.f90: New test.
+
 2018-08-11  Jakub Jelinek  <jakub@redhat.com>
 
        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 (file)
index 0000000..a26df9e
--- /dev/null
@@ -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  <damian@sourceryinstitute.org>
+!
+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