http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54389

Tobias Burnus <burnus at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |wrong-code
                 CC|                            |burnus at gcc dot gnu.org
            Summary|[F2003/F2008 difference]    |[F2003/F2008 difference]
                   |PURE functions and pointer  |PURE functions and pointer
                   |dummy arguments             |dummy arguments /
                   |                            |DECL_PURE_P issue

--- Comment #1 from Tobias Burnus <burnus at gcc dot gnu.org> 2012-08-28 
08:39:54 UTC ---
Post script: I think one can argue that the F2008 change makes sense: If one
has specified INTENT(OUT)/INTENT(INOUT), it doesn't make sense to treat it as
INTENT(IN). Additionally, the pointer attribute of the actual and dummy
argument already ensures that certain alias issues do not occur.

(I looked at the Fortran 2003 corrigenda 1 to 5 and at the Fortran 2008
corrigendum 1 - and at some IR, but I couldn't find anything relevant there.)

I am not 100% sure whether it matches with DECL_PURE_P. It actually doesn't
seems so do so:
  DECL_PURE_P
    This predicate holds if the function can only read its arguments, but may
    also read global memory.

Hence, we need to be careful with it for declaring (implicitly) pure functions.

 * * * 

Side note: The following code is wrong due to IMPURE ELEMENTAL:

  if (sym->attr.pure || sym->attr.elemental)
    {
      if (sym->attr.function && !gfc_return_by_reference (sym))
        DECL_PURE_P (fndecl) = 1;

Reply via email to