This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug fortran/51502] [4.6/4.7 Regression] Potentially wrong code generation due to wrong implict_pure check
- From: "tkoenig at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Sun, 11 Dec 2011 20:56:54 +0000
- Subject: [Bug fortran/51502] [4.6/4.7 Regression] Potentially wrong code generation due to wrong implict_pure check
- Auto-submitted: auto-generated
- References: <bug-51502-4@http.gcc.gnu.org/bugzilla/>
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51502
--- Comment #2 from Thomas Koenig <tkoenig at gcc dot gnu.org> 2011-12-11 20:56:54 UTC ---
The problem occurs in expr.c:
if (!pointer && gfc_implicit_pure (NULL) && gfc_impure_variable (sym))
gfc_current_ns->proc_name->attr.implicit_pure = 0;
assumes that gfc_current_ns points to the current procedure, which
is wrong in the case of blocks.
Maybe it would make sense to have a global gfc_proc_name?
Also, the logic in gfc_implicit_pure() appears to be wrong
because it does not look for parent namespaces.