From: Steven G. Kargl Date: Thu, 28 Jul 2016 23:12:23 +0000 (+0000) Subject: re PR fortran/71067 (ICE on data initialization with insufficient value) X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=89f1f37ea61d1eff9f01e9a580f44f1964500bc1;p=gcc.git re PR fortran/71067 (ICE on data initialization with insufficient value) 2016-07-28 Steven G. Kargl PR fortran/71067 * decl.c (match_data_constant): On error, set 'result' to NULL. 2016-07-28 Steven G. Kargl PR fortran/71067 * gfortran.dg/pr71067_1.f90: New test. * gfortran.dg/pr71067_2.f90: Ditto. From-SVN: r238842 --- diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index 752fb02d4b0..b9ca1065b18 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,3 +1,8 @@ +2016-07-28 Steven G. Kargl + + PR fortran/71067 + * decl.c (match_data_constant): On error, set 'result' to NULL. + 2016-07-28 Steven G. Kargl PR fortran/71799 diff --git a/gcc/fortran/decl.c b/gcc/fortran/decl.c index 1b62833f62f..cf750391ef1 100644 --- a/gcc/fortran/decl.c +++ b/gcc/fortran/decl.c @@ -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)) diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 239cf67c12d..a588afecbef 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,9 @@ +2016-07-28 Steven G. Kargl + + PR fortran/71067 + * gfortran.dg/pr71067_1.f90: New test. + * gfortran.dg/pr71067_2.f90: Ditto. + 2016-07-28 Michael Meissner * 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 index 00000000000..76fbcfb470b --- /dev/null +++ b/gcc/testsuite/gfortran.dg/pr71067_1.f90 @@ -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 index 00000000000..6fac4c524cc --- /dev/null +++ b/gcc/testsuite/gfortran.dg/pr71067_2.f90 @@ -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