This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [Patch, Fortran] PRs 60283/60543: Fix two wrong-code bugs related for implicit pure
- From: Tobias Burnus <burnus at net-b dot de>
- To: Paul Richard Thomas <paul dot richard dot thomas at gmail dot com>
- Cc: gcc-patches <gcc-patches at gcc dot gnu dot org>, gfortran <fortran at gcc dot gnu dot org>
- Date: Wed, 19 Mar 2014 22:56:57 +0100
- Subject: Re: [Patch, Fortran] PRs 60283/60543: Fix two wrong-code bugs related for implicit pure
- Authentication-results: sourceware.org; auth=none
- References: <5325F9BB dot 1090201 at net-b dot de> <5329FC31 dot 20601 at net-b dot de> <CAGkQGiLUpHVRnxCKt3TPQaCZZ4dg0sV7gXYoHvUdsn0mtqs4_w at mail dot gmail dot com>
Paul Richard Thomas wrote:
The patch looks OK to me. If nothing else, it offers a
rationalisation of all the lines of code that unset the attribute!
I am somewhat puzzled by "Note: I failed to create a test case",
wheras I find one at the end of the patch. Can you explain what you
mean?
What I meant was that I failed to create a run-time test case, which
fails without the patch. However, after I wrote that, I saw that there
is a dg-* which permits to check the .mod file for a string. That's why
I could include a test case.
Committed to the trunk as Rev. 208687.
While looking at the patch again for backporting, I saw that I have
missed the following parts. I will commit them tomorrow as obvious,
unless someone protests.
Tobias
2014-03-19 Tobias Burnus <burnus@net-b.>
PR fortran/60543
* io.c (check_io_constraints): Use gfc_unset_implicit_pure.
* resolve.c (resolve_ordinary_assign): Ditto.
Index: gcc/fortran/io.c
===================================================================
--- gcc/fortran/io.c (Revision 208687)
+++ gcc/fortran/io.c (Arbeitskopie)
@@ -3259,9 +3259,8 @@ if (condition) \
"an internal file in a PURE procedure",
io_kind_name (k));
- if (gfc_implicit_pure (NULL) && (k == M_READ || k == M_WRITE))
- gfc_current_ns->proc_name->attr.implicit_pure = 0;
-
+ if (k == M_READ || k == M_WRITE)
+ gfc_unset_implicit_pure (NULL);
}
if (k != M_READ)
Index: gcc/fortran/resolve.c
===================================================================
--- gcc/fortran/resolve.c (Revision 208687)
+++ gcc/fortran/resolve.c (Arbeitskopie)
@@ -9165,7 +9165,7 @@ resolve_ordinary_assign (gfc_code *code, gfc_names
if (lhs->expr_type == EXPR_VARIABLE
&& lhs->symtree->n.sym != gfc_current_ns->proc_name
&& lhs->symtree->n.sym->ns != gfc_current_ns)
- gfc_current_ns->proc_name->attr.implicit_pure = 0;
+ gfc_unset_implicit_pure (NULL);
if (lhs->ts.type == BT_DERIVED
&& lhs->expr_type == EXPR_VARIABLE
@@ -9173,11 +9173,11 @@ resolve_ordinary_assign (gfc_code *code, gfc_names
&& rhs->expr_type == EXPR_VARIABLE
&& (gfc_impure_variable (rhs->symtree->n.sym)
|| gfc_is_coindexed (rhs)))
- gfc_current_ns->proc_name->attr.implicit_pure = 0;
+ gfc_unset_implicit_pure (NULL);
/* Fortran 2008, C1283. */
if (gfc_is_coindexed (lhs))
- gfc_current_ns->proc_name->attr.implicit_pure = 0;
+ gfc_unset_implicit_pure (NULL);
}
/* F2008, 7.2.1.2. */