aboutsummaryrefslogtreecommitdiff
path: root/gcc/fortran/intrinsic.c
diff options
context:
space:
mode:
authorTobias Burnus <burnus@net-b.de>2014-03-19 22:03:14 +0100
committerTobias Burnus <burnus@gcc.gnu.org>2014-03-19 22:03:14 +0100
commitccd7751b3424a4e5082a57341789649bc495f0c6 (patch)
treeb646ebd40aee24f252c9460c48fd6dd3ba729e86 /gcc/fortran/intrinsic.c
parent7d092805ba995e042a89072bcbf2948800d87d3f (diff)
downloadgcc-ccd7751b3424a4e5082a57341789649bc495f0c6.zip
gcc-ccd7751b3424a4e5082a57341789649bc495f0c6.tar.gz
gcc-ccd7751b3424a4e5082a57341789649bc495f0c6.tar.bz2
re PR fortran/60543 (Function with side effect removed by the optimizer.)
2014-03-18 Tobias Burnus <burnus@net-b.de> PR fortran/60543 PR fortran/60283 * gfortran.h (gfc_unset_implicit_pure): New prototype. * resolve.c (gfc_unset_implicit_pure): New. (resolve_structure_cons, resolve_function, pure_subroutine): Use it. * decl.c (match_old_style_init, gfc_match_data, match_pointer_init, variable_decl): Ditto. * expr.c (gfc_check_pointer_assign): Ditto. * intrinsic.c (gfc_intrinsic_sub_interface): Ditto. * io.c (match_vtag, gfc_match_open, gfc_match_close, match_filepos, gfc_match_inquire, gfc_match_print, gfc_match_wait): Ditto. * match.c (gfc_match_critical, gfc_match_stopcode, lock_unlock_statement, sync_statement, gfc_match_allocate, gfc_match_deallocate): Ditto. * parse.c (decode_omp_directive): Ditto. * symbol.c (gfc_add_save): Ditto. 2014-03-18 Tobias Burnus <burnus@net-b.de> PR fortran/60543 PR fortran/60283 * gfortran.dg/implicit_pure_4.f90: New. From-SVN: r208687
Diffstat (limited to 'gcc/fortran/intrinsic.c')
-rw-r--r--gcc/fortran/intrinsic.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/gcc/fortran/intrinsic.c b/gcc/fortran/intrinsic.c
index 3db000b..19d4620 100644
--- a/gcc/fortran/intrinsic.c
+++ b/gcc/fortran/intrinsic.c
@@ -4404,13 +4404,16 @@ gfc_intrinsic_sub_interface (gfc_code *c, int error_flag)
return MATCH_ERROR;
}
- if (gfc_pure (NULL) && !isym->pure)
+ if (!isym->pure && gfc_pure (NULL))
{
gfc_error ("Subroutine call to intrinsic '%s' at %L is not PURE", name,
&c->loc);
return MATCH_ERROR;
}
+ if (!isym->pure)
+ gfc_unset_implicit_pure (NULL);
+
c->resolved_sym->attr.noreturn = isym->noreturn;
return MATCH_YES;