2009-11-21 Jerry DeLisle <jvdelisle@gcc.gnu.org>
authorjvdelisle <jvdelisle@138bc75d-0d04-0410-961f-82ee72b054a4>
Sun, 22 Nov 2009 02:05:12 +0000 (02:05 +0000)
committerjvdelisle <jvdelisle@138bc75d-0d04-0410-961f-82ee72b054a4>
Sun, 22 Nov 2009 02:05:12 +0000 (02:05 +0000)
PR fortran/41807
* gfortran.dg/data_value_1.f90: Update test.
* gfortran.dg/array_constructor_32.f90: New test.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@154419 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/testsuite/ChangeLog
gcc/testsuite/gfortran.dg/array_constructor_32.f90 [new file with mode: 0644]
gcc/testsuite/gfortran.dg/data_value_1.f90

index a23042d..68e7afa 100644 (file)
@@ -1,3 +1,9 @@
+2009-11-21  Jerry DeLisle  <jvdelisle@gcc.gnu.org>
+
+       PR fortran/41807
+       * gfortran.dg/data_value_1.f90: Update test.
+       * gfortran.dg/array_constructor_32.f90: New test.
+
 2009-11-21  Martin Jambor  <mjambor@suse.cz>
 
        PR middle-end/42025
diff --git a/gcc/testsuite/gfortran.dg/array_constructor_32.f90 b/gcc/testsuite/gfortran.dg/array_constructor_32.f90
new file mode 100644 (file)
index 0000000..5cf49ae
--- /dev/null
@@ -0,0 +1,28 @@
+! { dg-do run }
+! PR41807  data statement with nested type constructors
+! Test case provided by Steve Kargl
+  implicit none
+
+  type :: a
+     real :: x(3)
+  end type a
+
+  integer, parameter :: n = 3
+
+  type(a) :: b(n)
+
+  real, parameter :: d1(3) = (/1., 2., 3./)
+  real, parameter :: d2(3) = (/4., 5., 6./)
+  real, parameter :: d3(3) = (/7., 8., 9./)
+
+  integer :: i, z(n)
+  data (b(i), i = 1, n) /a(d1), a(d2), a(d3)/
+  data (z(i), i = 1, n) / 1, 2, 3/
+
+  if (any(z.ne.[1, 2, 3])) call abort
+  if (any(b(1)%x.ne.[1, 2, 3]) .or. &
+      any(b(2)%x.ne.[4, 5, 6]) .or. &
+      any(b(3)%x.ne.[7, 8, 9])) call abort
+end
+
index ea05a91..cb3e4c3 100644 (file)
@@ -3,12 +3,14 @@
 ! is not a constant and so the DATA statement did not have
 ! a constant value expression.
 !
+! Modified dg-error for PR41807
+!
 ! 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" }
+      DATA P / POINT(1.+X) / ! { dg-error "non-constant initialization" }
       print *, p
       END