This is the mail archive of the
fortran@gcc.gnu.org
mailing list for the GNU Fortran project.
[Committed] PR fortran/71067 -- set a pointer to NULL
- From: Steve Kargl <sgk at troutmask dot apl dot washington dot edu>
- To: fortran at gcc dot gnu dot org, gcc-patches at gcc dot gnu dot org
- Date: Thu, 28 Jul 2016 16:16:16 -0700
- Subject: [Committed] PR fortran/71067 -- set a pointer to NULL
- Authentication-results: sourceware.org; auth=none
Committed as obvious.
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.
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