re PR fortran/71067 (ICE on data initialization with insufficient value)
authorSteven G. Kargl <kargl@gcc.gnu.org>
Thu, 28 Jul 2016 23:12:23 +0000 (23:12 +0000)
committerSteven G. Kargl <kargl@gcc.gnu.org>
Thu, 28 Jul 2016 23:12:23 +0000 (23:12 +0000)
2016-07-28  Steven G. Kargl  <kargl@gcc.gnu.org>

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

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

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

From-SVN: r238842

gcc/fortran/ChangeLog
gcc/fortran/decl.c
gcc/testsuite/ChangeLog
gcc/testsuite/gfortran.dg/pr71067_1.f90 [new file with mode: 0644]
gcc/testsuite/gfortran.dg/pr71067_2.f90 [new file with mode: 0644]

index 752fb02d4b00675a3bf1af14cf0e5e76949b2b63..b9ca1065b18c104ff8222194c968d38d16d8a64c 100644 (file)
@@ -1,3 +1,8 @@
+2016-07-28  Steven G. Kargl  <kargl@gcc.gnu.org>
+
+       PR fortran/71067
+       * decl.c (match_data_constant): On error, set 'result' to NULL.
+
 2016-07-28  Steven G. Kargl  <kargl@gcc.gnu.org>
 
        PR fortran/71799
index 1b62833f62fcf2f95f2bb6d934e9fe27bcc0eeba..cf750391ef1f6ca47ff4a1b3e300844f8071973d 100644 (file)
@@ -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 239cf67c12dc91aa3590acd00d59015d975c178b..a588afecbef7790aedb2f7a345c7475d96bfe0fd 100644 (file)
@@ -1,3 +1,9 @@
+2016-07-28  Steven G. Kargl  <kargl@gcc.gnu.org>
+
+       PR fortran/71067
+       * gfortran.dg/pr71067_1.f90: New test.
+       * gfortran.dg/pr71067_2.f90: Ditto.
+
 2016-07-28  Michael Meissner  <meissner@linux.vnet.ibm.com>
 
        * gcc.target/powerpc/vec-extract-1.c: New test.
diff --git a/gcc/testsuite/gfortran.dg/pr71067_1.f90 b/gcc/testsuite/gfortran.dg/pr71067_1.f90
new file mode 100644 (file)
index 0000000..76fbcfb
--- /dev/null
@@ -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
diff --git a/gcc/testsuite/gfortran.dg/pr71067_2.f90 b/gcc/testsuite/gfortran.dg/pr71067_2.f90
new file mode 100644 (file)
index 0000000..6fac4c5
--- /dev/null
@@ -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