This is the mail archive of the
fortran@gcc.gnu.org
mailing list for the GNU Fortran project.
Re: [Testsuite patch]: new fortran tests
- From: Uttam Pawar <uttamp at us dot ibm dot com>
- To: Tobias Schlüter <tobias dot schlueter at physik dot uni-muenchen dot de>
- Cc: gcc-patches at gcc dot gnu dot org, fortran at gcc dot gnu dot org
- Date: Mon, 14 Nov 2005 10:21:11 -0800
- Subject: Re: [Testsuite patch]: new fortran tests
- References: <1131722739.7547.6.camel@linux.site> <4374DFDA.2000900@physik.uni-muenchen.de>
> You should not only verify that the compiler compiles the testcase and creates
> a testcase, but also that it produces correct code, e.g. something like
Actually the test case supposed to check only the constraints on DO
construct as in real and double precision variables are not allowed
according to the standard (fortran 95), which can be checked at the
compile time (with -std=f95) itself right?
> ! { dg-do run }
> integer n
> double precision y
> n = 0
> do y = 0.0,10.0,1.0
> n = n + 1
> end do
> if (n .ne. 55) call abort ()
> end
>
> You may also want to add similar code which uses a real*4 variable. (Steve
> already pointed out that there is an existing testcase for this, also your
> testcase looks wrong as in it might take a very long time to finish given your
> loop condition.)
But following is the updated testcase (patch) for this particular case,
2005-11-14 Uttam Pawar <uttamp@us.ibm.com>
* gfortran.dg/real_do_2.f90: New test.
diff -urNp gcc.testsuite/gfortran.dg/real_do_2.f90 gcc_mine.testsuite/gfortran.dg/real_do_2.f90
--- gcc.testsuite/gfortran.dg/real_do_2.f90 1969-12-31 16:00:00.000000000 -0800
+++ gcc_mine.testsuite/gfortran.dg/real_do_2.f90 2005-11-14 09:58:17.000000000 -0800
@@ -0,0 +1,25 @@
+! { dg-do compile }
+! { dg-options "-std=f95" }
+! Test REAL type iterators in DO loops
+program real_do_2
+ real x
+ real*4 y
+ double precision z
+ integer n
+
+ n = 0
+ do x = 0.0,10.0,1.0 ! { dg-error "Obsolete: REAL DO loop iterator" "" }
+ n = n + 1
+ end do
+ if (n .ne. 11) call abort()
+ n = 0
+ do y = 0.0,10.0,1.0 ! { dg-error "Obsolete: REAL DO loop iterator" ""}
+ n = n + 1
+ end do
+ if (n .ne. 11) call abort()
+ n = 0
+ do z = 0.0,10.0,1.0 ! { dg-error "Obsolete: REAL DO loop iterator" ""}
+ n = n + 1
+ end do
+ if (n .ne. 11) call abort()
+end program