https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63514
kargl at gcc dot gnu.org changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |kargl at gcc dot gnu.org --- Comment #4 from kargl at gcc dot gnu.org --- (In reply to Richard Biener from comment #2) > The fortran frontend must do sth wrong here - it seems to mark the function > pure itself and either fold or the FE even does the optimization (look at > the .original dump). A Fortran compiler is free to assume that a function does not have side-effects. The Fortran standard does provide a programmer with the PURE and IMPURE attribute that can be used to provide hints to the compiler. If neither PURE nor IMPURE appears in a function declaration, the standard does not specify how the function is treated with respect to pureness of impureness. It is also noted that only requirement on IMPURE is with an IMPURE ELEMENTAL subprogram. In this situation, the array elements of an actual argument must be handled in array element order. There is, however, a bug with respect to F2018: C1588 A local variable of a pure subprogram, or of a BLOCK construct within a pure subprogram, shall not have the SAVE or VOLATILE attribute. gfortran is required to issue an error message, which she doesn't at the moment. Other than fixing C1588, I think this should be closed as WONTFIX. A programmer, who depends on function side-effects, should have his or her programming card revoked.