re PR fortran/40402 (Problem with data statement involving structure constructors containing non-initialisation expressions)

2009-06-11  Paul Thomas  <pault@gcc.gnu.org>

	PR fortran/40402
	* resolve.c (next_data_value): It is an error if the value is
	not constant.

2009-06-11  Paul Thomas  <pault@gcc.gnu.org>

	PR fortran/40402
	* gfortran.dg/data_value_1.f90: New test.

From-SVN: r148396
This commit is contained in:
Paul Thomas 2009-06-11 20:11:59 +00:00
parent 5514b0f3df
commit abeab93869
4 changed files with 29 additions and 1 deletions

View File

@ -1,3 +1,9 @@
2009-06-11 Paul Thomas <pault@gcc.gnu.org>
PR fortran/40402
* resolve.c (next_data_value): It is an error if the value is
not constant.
2009-06-11 Francois-Xavier Coudert <fxcoudert@gcc.gnu.org>
PR fortran/38718

View File

@ -9852,9 +9852,12 @@ values;
static gfc_try
next_data_value (void)
{
while (mpz_cmp_ui (values.left, 0) == 0)
{
if (!gfc_is_constant_expr (values.vnode->expr))
gfc_error ("non-constant DATA value at %L",
&values.vnode->expr->where);
if (values.vnode->next == NULL)
return FAILURE;

View File

@ -1,3 +1,8 @@
2009-06-11 Paul Thomas <pault@gcc.gnu.org>
PR fortran/40402
* gfortran.dg/data_value_1.f90: New test.
2009-06-11 Francois-Xavier Coudert <fxcoudert@gcc.gnu.org>
PR testsuite/39831

View File

@ -0,0 +1,14 @@
! { dg-do compile }
! Test the fix for PR40402, in which it was not detected that X
! is not a constant and so the DATA statement did not have
! a constant value expression.
!
! Contributed by Philippe Marguinaud <philippe.marguinaud@meteo.fr>
!
TYPE POINT
REAL :: X
ENDTYPE
TYPE(POINT) :: P
DATA P / POINT(1.+X) / ! { dg-error "non-constant DATA value" }
print *, p
END