aboutsummaryrefslogtreecommitdiff
path: root/gcc/fortran/resolve.c
diff options
context:
space:
mode:
authorTobias Burnus <burnus@net-b.de>2011-11-24 18:57:41 +0100
committerTobias Burnus <burnus@gcc.gnu.org>2011-11-24 18:57:41 +0100
commit3d2cea8c44f8e1e428edb6f17fe12c69301c8fe1 (patch)
treeef5b6ae7f6d3f0ef6952e6842559e3697139a18e /gcc/fortran/resolve.c
parent603518caa7ae818b427009c7caef1bf63894b3ef (diff)
downloadgcc-3d2cea8c44f8e1e428edb6f17fe12c69301c8fe1.zip
gcc-3d2cea8c44f8e1e428edb6f17fe12c69301c8fe1.tar.gz
gcc-3d2cea8c44f8e1e428edb6f17fe12c69301c8fe1.tar.bz2
re PR fortran/51218 (Potential optimization bug due to implicit_pure?)
2011-11-24 Tobias Burnus <burnus@net-b.de> PR fortran/51218 * resolve.c (pure_subroutine): If called subroutine is impure, unset implicit_pure. (resolve_function): Move impure check to simplify code. 2011-11-24 Tobias Burnus <burnus@net-b.de> PR fortran/51218 * gfortran.dg/implicit_pure_1.f90: New. From-SVN: r181698
Diffstat (limited to 'gcc/fortran/resolve.c')
-rw-r--r--gcc/fortran/resolve.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/gcc/fortran/resolve.c b/gcc/fortran/resolve.c
index 94c21be..6baeff44 100644
--- a/gcc/fortran/resolve.c
+++ b/gcc/fortran/resolve.c
@@ -3191,10 +3191,10 @@ resolve_function (gfc_expr *expr)
"procedure within a PURE procedure", name, &expr->where);
t = FAILURE;
}
- }
- if (!pure_function (expr, &name) && name && gfc_implicit_pure (NULL))
- gfc_current_ns->proc_name->attr.implicit_pure = 0;
+ if (gfc_implicit_pure (NULL))
+ gfc_current_ns->proc_name->attr.implicit_pure = 0;
+ }
/* Functions without the RECURSIVE attribution are not allowed to
* call themselves. */
@@ -3257,6 +3257,9 @@ pure_subroutine (gfc_code *c, gfc_symbol *sym)
else if (gfc_pure (NULL))
gfc_error ("Subroutine call to '%s' at %L is not PURE", sym->name,
&c->loc);
+
+ if (gfc_implicit_pure (NULL))
+ gfc_current_ns->proc_name->attr.implicit_pure = 0;
}