Committed as obvious.

2016-07-28  Steven G. Kargl  <ka...@gcc.gnu.org>

        PR fortran/71067
        * decl.c (match_data_constant): On error, set 'result' to NULL.

2016-07-28  Steven G. Kargl  <ka...@gcc.gnu.org>

        PR fortran/71067
        * gfortran.dg/pr71067_1.f90: New test.
        * gfortran.dg/pr71067_2.f90: Ditto.

Index: gcc/fortran/decl.c
===================================================================
--- gcc/fortran/decl.c  (revision 238824)
+++ gcc/fortran/decl.c  (working copy)
@@ -395,6 +395,7 @@ match_data_constant (gfc_expr **result)
     {
       gfc_error ("Symbol %qs must be a PARAMETER in DATA statement at %C",
                 name);
+      *result = NULL;
       return MATCH_ERROR;
     }
   else if (dt_sym && gfc_fl_struct (dt_sym->attr.flavor))
Index: gcc/testsuite/gfortran.dg/pr71067_1.f90
===================================================================
--- gcc/testsuite/gfortran.dg/pr71067_1.f90     (nonexistent)
+++ gcc/testsuite/gfortran.dg/pr71067_1.f90     (working copy)
@@ -0,0 +1,5 @@
+program p
+   integer :: i = 0
+   integer :: z(2)
+   data z /2*i/ ! { dg-error "must be a PARAMETER in DATA" }
+end
Index: gcc/testsuite/gfortran.dg/pr71067_2.f90
===================================================================
--- gcc/testsuite/gfortran.dg/pr71067_2.f90     (nonexistent)
+++ gcc/testsuite/gfortran.dg/pr71067_2.f90     (working copy)
@@ -0,0 +1,7 @@
+! { dg-do compile }
+program p
+   integer :: a(2), b(2), c(2)
+   data a /2*b1'/ ! { dg-error "must be a PARAMETER in DATA" }
+   data b /2*o1'  ! { dg-error "must be a PARAMETER in DATA" }
+   data c /2*z1   ! { dg-error "must be a PARAMETER in DATA" }
+end
-- 
Steve

Reply via email to