https://gcc.gnu.org/bugzilla/show_bug.cgi?id=119836

--- Comment #9 from kargls at comcast dot net ---
(In reply to kargls from comment #4)

> +       bool is_pure = e->value.function.isym
> +                      || (e->value.function.esym
> +                          && (e->value.function.esym->attr.pure
> +                              || e->value.function.esym->attr.elemental));
> +       if (!is_pure)
> +         {
> +           gfc_error ("Reference to impure function at %L inside a "
> +                      "DO CONCURRENT", &e->where);
> +           return false;
> +         }

All, the patch is slightly incorrect.  The intrinsic functions described
in the Fortran 2023 standard are simple (i.e., pure).  gfortran supplies
~110 routines that have CLASS_IMPURE (i.e., grep CLASS_IMPURE intrinsic.cc).
Some are functions and some are subroutines.  We need to also check
attr.pure and attr.elemental for the isym.

As a side note, we may want to review the added routines to see if
they can be made pure or deprecate the functions (with removal in
GCC 16 or 17).  For example, IARGC() is impure, but simply returns
the number of command line arguments.  It has no side-effects, so
could be marked as pure.

As an additional side note, Fortran 2023 defines simple routines
in 15.8 where there is a list of constraints.  We should probably
add a attr.simple and use it.

Reply via email to