[Bug fortran/54556] [4.8 Regression] Marking implicitly pure variables as DECL_PURE_P leads to wrong code

burnus at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Wed Sep 12 22:18:00 GMT 2012


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

Tobias Burnus <burnus at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2012-09-12
     Ever Confirmed|0                           |1

--- Comment #10 from Tobias Burnus <burnus at gcc dot gnu.org> 2012-09-12 22:18:15 UTC ---
In expr.c's gfc_check_vardef_context one calls:

  if (!pointer && context && gfc_implicit_pure (NULL)
      && gfc_impure_variable (sym))

The problem is that the latter has (cf. resolve.c):

  if (sym->attr.dummy && gfc_pure (proc)
        && ((proc->attr.subroutine && sym->attr.intent == INTENT_IN)
                ||
             proc->attr.function))

The issue is "gfc_pure".


Draft patch (replaces the one in comment 9):

--- a/gcc/fortran/resolve.c
+++ b/gcc/fortran/resolve.c
@@ -13567,6 +13572,5 @@ gfc_impure_variable (gfc_symbol *sym)
   proc = sym->ns->proc_name;
-  if (sym->attr.dummy && gfc_pure (proc)
-       && ((proc->attr.subroutine && sym->attr.intent == INTENT_IN)
-               ||
-            proc->attr.function))
+  if (sym->attr.dummy
+      && ((proc->attr.subroutine && sym->attr.intent == INTENT_IN)
+         || proc->attr.function))
     return 1;



More information about the Gcc-bugs mailing list