re PR fortran/18525 (ICE on valid code in gfc_get_symbol_decl())
authorTobias Schlüter <tobi@gcc.gnu.org>
Sat, 19 Mar 2005 19:45:45 +0000 (20:45 +0100)
committerTobias Schlüter <tobi@gcc.gnu.org>
Sat, 19 Mar 2005 19:45:45 +0000 (20:45 +0100)
fortran/
* dump-parse-tree.c (gfc_show_expr): Dump name of namespace
in which the variable is declared.

PR fortran/18525
* resolve.c (was_declared): Also check for dummy attribute.

testsuite/
PR fortran/18525
* gfortran.dg/nesting_1.f90: New test.

From-SVN: r96739

gcc/fortran/ChangeLog
gcc/fortran/dump-parse-tree.c
gcc/fortran/resolve.c
gcc/testsuite/ChangeLog
gcc/testsuite/gfortran.dg/nesting_1.f90 [new file with mode: 0644]

index 0adec316a712df1a22681c8aa791983513e25fa9..762b393296ebd5e989556f627cc855cadb0bb53a 100644 (file)
@@ -1,3 +1,11 @@
+2005-03-18  Tobias Schl"uter  <tobias.schlueter@physik.uni-muenchen.de>
+
+       * dump-parse-tree.c (gfc_show_expr): Dump name of namespace
+       in which the variable is declared.
+
+       PR fortran/18525
+       * resolve.c (was_declared): Also check for dummy attribute.
+
 2005-03-18  Tobias Schl"uter  <tobias.schlueter@physik.uni-muenchen.de>
 
        * gfortran.h (arith): Remove ARITH_0TO0.
index f8df9dabb124d9d50bfdf8df4e74eac6377421ea..3df244cca71e749e5128c8f88725f90412829fa2 100644 (file)
@@ -409,6 +409,8 @@ gfc_show_expr (gfc_expr * p)
       break;
 
     case EXPR_VARIABLE:
+      if (p->symtree->n.sym->ns && p->symtree->n.sym->ns->proc_name)
+       gfc_status ("%s:", p->symtree->n.sym->ns->proc_name->name);
       gfc_status ("%s", p->symtree->n.sym->name);
       gfc_show_ref (p->ref);
       break;
index 730f4fb1fed3bfc62eb78f96827edae543835006..16db94342d10d0d4c50d723da39d6b0eefe6a20f 100644 (file)
@@ -481,7 +481,7 @@ was_declared (gfc_symbol * sym)
   if (!a.implicit_type && sym->ts.type != BT_UNKNOWN)
     return 1;
 
-  if (a.allocatable || a.dimension || a.external || a.intrinsic
+  if (a.allocatable || a.dimension || a.dummy || a.external || a.intrinsic
       || a.optional || a.pointer || a.save || a.target
       || a.access != ACCESS_UNKNOWN || a.intent != INTENT_UNKNOWN)
     return 1;
index 4d8392038ea8cbe2305c825f72afee75661051ca..6af630a730d17fb91ef3422d273f5f5131bf9cfa 100644 (file)
@@ -1,3 +1,8 @@
+2005-03-19  Tobias Schlueter  <tobias.schlueter@physik.uni-muenchen.de>
+
+       PR fortran/18525
+       * gfortran.dg/nesting_1.f90: New test.
+
 2005-03-19  Kriang Lerdsuwanakij  <lerdsuwa@users.sourceforge.net>
 
        PR c++/20240
diff --git a/gcc/testsuite/gfortran.dg/nesting_1.f90 b/gcc/testsuite/gfortran.dg/nesting_1.f90
new file mode 100644 (file)
index 0000000..51ebfd9
--- /dev/null
@@ -0,0 +1,18 @@
+! PR 18525
+! we used to incorrectly refer to n from a when resolving the call to
+! c from b
+! { dg-do run }
+subroutine a(n)
+call b(n+1)
+contains
+  subroutine b(n)
+    call c(n)
+  end subroutine b
+
+  subroutine c(m)
+    if (m/=1) call abort
+  end subroutine c
+end subroutine a
+
+call a(0)
+end