This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[gfortran] new testcases for 'pure' and cpu_time
- From: Uttam Pawar <uttamp at us dot ibm dot com>
- To: gcc-patches at gcc dot gnu dot org
- Cc: fortran at gcc dot gnu dot org
- Date: Mon, 24 Oct 2005 14:12:59 -0700
- Subject: [gfortran] new testcases for 'pure' and cpu_time
Hi,
I'm in writing new tests as part of f95 compliance testing of gfortran.
This is my first attempt with 2 tests, one for 'pure' procedure and
'cpu_time' intrinsic function.
My attempt is to test each one of the intrinsic function for the
constraints as per the standard.
Can anybody verify it and send me some feedback, please?
Thanks,
Uttam
--- testsuite/ChangeLog 2005-10-24 09:40:49.000000000 -0700
+++ testsuite/ChangeLog.new 2005-10-24 13:56:35.000000000 -0700
@@ -1,3 +1,9 @@
+2005-10-24 Uttam Pawar <uttamp@us.ibm.com>
+
+ * gfortran.dg/cpu_time_1.f90: New test(s) for cpu_time intrinsic.
+
+ * gfortran.dg/pure_1.f90: New test(s) for 'PURE' procedure.
+
2005-10-23 Andrew Pinski <pinskia@physics.uc.edu>
PR fortran/23635
diff -urN /home/gccbuild/gcc_mline_anoncvs/gcc/gcc/testsuite/gfortran.dg/cpu_time_1.f90 testsuite/gfortran.dg/cpu_time_1.f90
--- /home/gccbuild/gcc_mline_anoncvs/gcc/gcc/testsuite/gfortran.dg/cpu_time_1.f90 1969-12-31 16:00:00.000000000 -0800
+++ testsuite/gfortran.dg/cpu_time_1.f90 2005-10-24 10:25:35.000000000 -0700
@@ -0,0 +1,14 @@
+! { dg-do compile }
+! Check that we reject expressions of not type REAL for the
+! CPU_TIME intrinsics.
+
+program test_cpu_time
+ character c_T1
+ character*2 s_T1
+ integer i_T1
+ complex cx_T1
+ call cpu_time(c_T1) ! { dg-error "must be REAL" "" }
+ call cpu_time(s_T1) ! { dg-error "must be REAL" "" }
+ call cpu_time(i_T1) ! { dg-error "must be REAL" "" }
+ call cpu_time(cx_T1) ! { dg-error "must be REAL" "" }
+end program test_cpu_time
diff -urN /home/gccbuild/gcc_mline_anoncvs/gcc/gcc/testsuite/gfortran.dg/pure_1.f90 testsuite/gfortran.dg/pure_1.f90
--- /home/gccbuild/gcc_mline_anoncvs/gcc/gcc/testsuite/gfortran.dg/pure_1.f90 1969-12-31 16:00:00.000000000 -0800
+++ testsuite/gfortran.dg/pure_1.f90 2005-10-24 11:02:00.000000000 -0700
@@ -0,0 +1,11 @@
+! { dg-do compile }
+! Check that constraints on pure procedure
+! and emits the right error message
+pure function pure_func ()
+ character str1*8
+ pause ! { dg-error "not allowed in PURE procedure" "" }
+ stop ! { dg-error "not allowed in PURE procedure" "" }
+ open(2, FILE='new.src') ! { dg-error "not allowed in PURE procedure" "" }
+ close(2) ! { dg-error "not allowed in PURE procedure" "" }
+ print *, "test msg" ! { dg-error "not allowed within PURE procedure" "" }
+end function pure_func