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

--- Comment #18 from janus at gcc dot gnu.org ---
(In reply to janus from comment #17)
> (In reply to janus from comment #16)
> > TODO: Fix also the issue with PURE/ELEMENTAL reported in comment 14.
> 
> Here is a small patch which does it:

This yields a rather large number of failures in the testsuite, due to errors
of the type:

  USE ISO_C_BINDING
      1
Error: Cannot change attributes of USE-associated symbol at (1)


This is avoided by the following improved patch (which just 'silently' sets the
attributes):

Index: gcc/fortran/resolve.c
===================================================================
--- gcc/fortran/resolve.c    (revision 202765)
+++ gcc/fortran/resolve.c    (working copy)
@@ -1679,6 +1679,9 @@ gfc_resolve_intrinsic (gfc_symbol *sym, locus *loc

   gfc_copy_formal_args_intr (sym, isym);

+  sym->attr.pure = isym->pure;
+  sym->attr.elemental = isym->elemental;
+
   /* Check it is actually available in the standard settings.  */
   if (!gfc_check_intrinsic_standard (isym, &symstd, false, sym->declared_at))
     {

Reply via email to