http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48112

--- Comment #5 from Tobias Burnus <burnus at gcc dot gnu.org> 2011-04-26 
13:50:53 UTC ---
(In reply to comment #4)
> The crucial part of the patch is:
> +  /* Avoid double resolution of function result symbols.  */
> +  if ((sym->result || sym->attr.result) && (sym->ns != gfc_current_ns))
> +    return;

If one backs out that part, one gets the diagnostic messages twice for
class_20.f03 - which was a general issue, unrelated to BT_CLASS.

 * * *

A variant combining both issues (this PR and class_20.f03) is:

module module_m
  type t
  end type t
  interface test
     function test1( )  result( test )
       import
       class(t) ::  test
     end function test1
  end interface test
end module module_m

For that program, only one error should be printed - and no ICE in module
writing ...

 * * *

Draft patch; note that resolve_fl_var_and_proc is *only* about diagnostics:

--- a/gcc/fortran/resolve.c
+++ b/gcc/fortran/resolve.c
@@ -9888,0 +9889,5 @@ resolve_fl_var_and_proc (gfc_symbol *sym, int mp_flag)
+  /* Avoid double diagnostics of function result symbols.  */
+  if ((sym->result || sym->attr.result) && !sym->attr.dummy
+      && (sym->ns != gfc_current_ns))
+    return SUCCESS;
+
@@ -11977,5 +11981,0 @@ resolve_symbol (gfc_symbol *sym)
-  /* Avoid double resolution of function result symbols.  */
-  if ((sym->result || sym->attr.result) && !sym->attr.dummy
-      && (sym->ns != gfc_current_ns))
-    return;

Reply via email to