]> gcc.gnu.org Git - gcc.git/commitdiff
re PR fortran/54107 ([F03] Memory hog with abstract interface)
authorMikael Morin <mikael@gcc.gnu.org>
Mon, 4 Feb 2013 18:34:30 +0000 (18:34 +0000)
committerMikael Morin <mikael@gcc.gnu.org>
Mon, 4 Feb 2013 18:34:30 +0000 (18:34 +0000)
fortran/
PR fortran/54107
PR fortran/54195
* gfortran.h (struct gfc_symbol): New field 'resolved'.
* resolve.c (resolve_fl_var_and_proc): Don't skip result symbols.
(resolve_symbol): Skip duplicate calls.  Don't check the current
namespace.

testsuite/
PR fortran/54107
* gfortran.dg/recursive_interface_1.f90: New test.

From-SVN: r195729

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

index 47be01fd0a90d7750d0fc248ab956f23cba8badf..bde2d1c6f3b413bef44f04f5fb111dfd8b9bbe0f 100644 (file)
@@ -1,3 +1,12 @@
+2013-02-04  Mikael Morin  <mikael@gcc.gnu.org>
+
+       PR fortran/54107
+       PR fortran/54195
+       * gfortran.h (struct gfc_symbol): New field 'resolved'.
+       * resolve.c (resolve_fl_var_and_proc): Don't skip result symbols.
+       (resolve_symbol): Skip duplicate calls.  Don't check the current
+       namespace.
+
 2013-02-02  Thomas Koenig  <tkoenig@gcc.gnu.org>
 
        PR fortran/50627
@@ -7,7 +16,7 @@
        * parse.c (parse_module):  Do not put namespace into
        gsymbol on error.
 
-2012-01-30  Tobias Burnus  <burnus@net-b.de>
+2013-01-30  Tobias Burnus  <burnus@net-b.de>
 
        PR fortran/56138
        * trans-decl.c (gfc_trans_deferred_vars): Fix deferred-length
        finalizer_insert_packed_call, generate_finalization_wrapper):
        Clean up by using gfc_build_intrinsic_call.
 
-2012-01-07  Tobias Burnus  <burnus@net-b.de>
+2013-01-07  Tobias Burnus  <burnus@net-b.de>
 
        PR fortran/55763
        * resolve.c (resolve_select_type): Reject intrinsic types for
index 16751b43d29fdd606d6db69a08ee3dbcfd4ad928..3b4b4738f204a980219f9fb9dda612746111ae0a 100644 (file)
@@ -1248,6 +1248,9 @@ typedef struct gfc_symbol
   unsigned equiv_built:1;
   /* Set if this variable is used as an index name in a FORALL.  */
   unsigned forall_index:1;
+  /* Used to avoid multiple resolutions of a single symbol.  */
+  unsigned resolved:1;
+
   int refs;
   struct gfc_namespace *ns;    /* namespace containing this symbol */
 
index d6bae43cf849be1d7cec7e7a384090da4de8e1cd..5083a5d04ddc401d601ef50e0e0964ddd4a6ab5a 100644 (file)
@@ -11051,11 +11051,6 @@ resolve_fl_var_and_proc (gfc_symbol *sym, int mp_flag)
 {
   gfc_array_spec *as;
 
-  /* Avoid double diagnostics for function result symbols.  */
-  if ((sym->result || sym->attr.result) && !sym->attr.dummy
-      && (sym->ns != gfc_current_ns))
-    return SUCCESS;
-
   if (sym->ts.type == BT_CLASS && sym->attr.class_ok)
     as = CLASS_DATA (sym)->as;
   else
@@ -13170,6 +13165,10 @@ resolve_symbol (gfc_symbol *sym)
   gfc_array_spec *as;
   bool saved_specification_expr;
 
+  if (sym->resolved)
+    return;
+  sym->resolved = 1;
+
   if (sym->attr.artificial)
     return;
 
@@ -13779,7 +13778,6 @@ resolve_symbol (gfc_symbol *sym)
      described in 14.7.5, to those variables that have not already
      been assigned one.  */
   if (sym->ts.type == BT_DERIVED
-      && sym->ns == gfc_current_ns
       && !sym->value
       && !sym->attr.allocatable
       && !sym->attr.alloc_comp)
index f4eb094c644f1a162cad275d4e22f28235293be9..8f407555dcbc632beadc4c7f776269cd73bd1519 100644 (file)
@@ -1,3 +1,8 @@
+2013-02-04  Mikael Morin  <mikael@gcc.gnu.org>
+
+       PR fortran/54107
+       * gfortran.dg/recursive_interface_1.f90: New test.
+
 2013-02-04  Richard Guenther  <rguenther@suse.de>
 
        PR lto/56168
        * lib/target-supports-dg.exp (dg-process-target): Use expr to
        evaluate the end index in string range.
 
-2012-01-30  Tobias Burnus  <burnus@net-b.de>
+2013-01-30  Tobias Burnus  <burnus@net-b.de>
 
        PR fortran/56138
        * gfortran.dg/allocatable_function_6.f90: New.
diff --git a/gcc/testsuite/gfortran.dg/recursive_interface_1.f90 b/gcc/testsuite/gfortran.dg/recursive_interface_1.f90
new file mode 100644 (file)
index 0000000..61db0c1
--- /dev/null
@@ -0,0 +1,20 @@
+! { dg-do compile }
+!
+! PR fortran/54107
+! The compiler used to ICE on recursive interfaces.
+
+module m
+ contains
+  function foo() result(r1)
+    procedure(foo), pointer :: r1 
+  end function foo
+
+  function bar() result(r2)
+    procedure(baz), pointer :: r2
+  end function bar
+
+  function baz() result(r3)
+    procedure(bar), pointer :: r3
+  end function baz
+end module m
+
This page took 0.094188 seconds and 5 git commands to generate.