From: Paul Thomas Date: Mon, 17 Aug 2009 20:17:12 +0000 (+0000) Subject: re PR fortran/41062 (ICE in gfc_trans_use_stmts, at fortran/trans-decl.c:3438) X-Git-Tag: releases/gcc-4.5.0~3960 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=1151ccc922e195087ce596ac58a09a113e58011b;p=thirdparty%2Fgcc.git re PR fortran/41062 (ICE in gfc_trans_use_stmts, at fortran/trans-decl.c:3438) 2008-08-17 Paul Thomas 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 PR fortran/41062 * gfortran.dg/use_only_4.f90: New test. From-SVN: r150858 --- diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index 10f95fb0cdfa..cf5b4ece3043 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,3 +1,9 @@ +2008-08-17 Paul Thomas + + 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 PR fortran/37425 diff --git a/gcc/fortran/trans-decl.c b/gcc/fortran/trans-decl.c index 3cc790381ae3..7fb571f5e57a 100644 --- a/gcc/fortran/trans-decl.c +++ b/gcc/fortran/trans-decl.c @@ -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 diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 7c905d7ad461..8a05c848f808 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2008-08-17 Paul Thomas + + PR fortran/41062 + * gfortran.dg/use_only_4.f90: New test. + 2009-08-17 Daniel Kraft 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 index 000000000000..a37db45ef777 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/use_only_4.f90 @@ -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 +! Reduced testcase by Tobias Burnus +! +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" } }