This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug fortran/65542] [5/6/7 Regression] SPREAD intrinsic incorrectly accepted in initialization expressions with -std=f95


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

Thomas Koenig <tkoenig at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |tkoenig at gcc dot gnu.org

--- Comment #5 from Thomas Koenig <tkoenig at gcc dot gnu.org> ---
Patch looks straightforward:

Index: intrinsic.c
===================================================================
--- intrinsic.c (Revision 244747)
+++ intrinsic.c (Arbeitskopie)
@@ -4680,6 +4680,27 @@ gfc_intrinsic_func_interface (gfc_expr *expr, int
       return MATCH_ERROR;
     }

+  /* F95, 7.1.6.1: Only transformational functions REPEAT, RESHAPE,
+     SELECTED_INT_KIND, SELECTED_REAL_KIND, TRANSFER, and TRIM are allowed in
+     initialization expressions.  */
+
+  if (gfc_init_expr_flag && isym->transformational)
+    {
+      gfc_isym_id id = isym->id;
+      if (id != GFC_ISYM_REPEAT && id != GFC_ISYM_RESHAPE
+         && id != GFC_ISYM_SI_KIND && id != GFC_ISYM_SR_KIND
+         && id != GFC_ISYM_TRANSFER && id != GFC_ISYM_TRIM
+         && !gfc_notify_std (GFC_STD_F2003, "Transformational function %qs "
+                             "invalid as initialization expression is at %L",
+                             name, &expr->where))
+       {
+         if (!error_flag)
+           gfc_pop_suppress_errors ();
+
+         return MATCH_ERROR;
+       }
+    }
+
   gfc_current_intrinsic_where = &expr->where;

   /* Bypass the generic list for min, max and ISO_C_Binding's c_loc.  */

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]