OSDN Git Service

2008-08-17 Paul Thomas <pault@gcc.gnu.org>
authorpault <pault@138bc75d-0d04-0410-961f-82ee72b054a4>
Mon, 17 Aug 2009 20:17:12 +0000 (20:17 +0000)
committerpault <pault@138bc75d-0d04-0410-961f-82ee72b054a4>
Mon, 17 Aug 2009 20:17:12 +0000 (20:17 +0000)
PR fortran/41062
* trans-decl.c (gfc_trans_use_stmts):  Keep going through use
list if symbol is not use associated.

2008-08-17  Paul Thomas  <pault@gcc.gnu.org>

PR fortran/41062
* gfortran.dg/use_only_4.f90: New test.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@150858 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/fortran/ChangeLog
gcc/fortran/trans-decl.c
gcc/testsuite/ChangeLog
gcc/testsuite/gfortran.dg/use_only_4.f90 [new file with mode: 0644]

index 10f95fb..cf5b4ec 100644 (file)
@@ -1,3 +1,9 @@
+2008-08-17  Paul Thomas  <pault@gcc.gnu.org>
+
+       PR fortran/41062
+       * trans-decl.c (gfc_trans_use_stmts):  Keep going through use
+       list if symbol is not use associated.
+
 2009-08-17  Daniel Kraft  <d@domob.eu>
 
        PR fortran/37425
index 3cc7903..7fb571f 100644 (file)
@@ -3426,7 +3426,13 @@ gfc_trans_use_stmts (gfc_namespace * ns)
              st = gfc_find_symtree (ns->sym_root,
                                     rent->local_name[0]
                                     ? rent->local_name : rent->use_name);
-             gcc_assert (st && st->n.sym->attr.use_assoc);
+             gcc_assert (st);
+
+             /* Sometimes, generic interfaces wind up being over-ruled by a
+                local symbol (see PR41062).  */
+             if (!st->n.sym->attr.use_assoc)
+               continue;
+
              if (st->n.sym->backend_decl
                  && DECL_P (st->n.sym->backend_decl)
                  && st->n.sym->module
index 7c905d7..8a05c84 100644 (file)
@@ -1,3 +1,8 @@
+2008-08-17  Paul Thomas  <pault@gcc.gnu.org>
+
+       PR fortran/41062
+       * gfortran.dg/use_only_4.f90: New test.
+
 2009-08-17  Daniel Kraft  <d@domob.eu>
 
        PR fortran/37425
diff --git a/gcc/testsuite/gfortran.dg/use_only_4.f90 b/gcc/testsuite/gfortran.dg/use_only_4.f90
new file mode 100644 (file)
index 0000000..a37db45
--- /dev/null
@@ -0,0 +1,34 @@
+! { dg-do compile }
+! Test the fix for PR41062, in which an ICE would ensue because
+! of confusion between the two 'one's in the creation of module
+! debug info.
+!
+! Reported by Norman S. Clerman <clerman@fuse.net>
+! Reduced testcase by Tobias Burnus <burnus@gcc.gnu.org>
+!
+module m1
+   interface one  ! GENERIC "one"
+     module procedure one1
+   end interface
+contains
+  subroutine one1()
+    call abort
+  end subroutine one1
+end module m1
+
+module m2
+use m1, only : one  ! USE generic "one"
+contains
+  subroutine two()
+    call one()  ! Call internal "one"
+  contains
+    subroutine one() ! Internal "one"
+      print *, "m2"
+    end subroutine one
+  end subroutine two
+end module m2
+
+  use m2
+  call two
+end
+! { dg-final { cleanup-modules "m1 m2" } }