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

kargl at gcc dot gnu.org changed:

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

--- Comment #5 from kargl at gcc dot gnu.org ---
Better patch.  Permits %re and %im in data statement.
program p
   complex, parameter :: a = (42.5,23)
   real :: b
   data b /a%re/
   print *, b
end

Index: gcc/fortran/decl.c
===================================================================
--- gcc/fortran/decl.c  (revision 266155)
+++ gcc/fortran/decl.c  (working copy)
@@ -388,6 +388,14 @@ match_data_constant (gfc_expr **result)
     }
   else if (m == MATCH_YES)
     {
+      /* If a parameter inquiry ends up here, symtree is NULL but **result
+        contains the right constant expression.  Check here.  */
+      if ((*result)->symtree == NULL
+         && (*result)->expr_type == EXPR_CONSTANT
+         && ((*result)->ts.type == BT_INTEGER 
+             || (*result)->ts.type == BT_REAL))
+       return m;
+
       /* F2018:R845 data-stmt-constant is initial-data-target.
         A data-stmt-constant shall be ... initial-data-target if and
         only if the corresponding data-stmt-object has the POINTER

Reply via email to