aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite
diff options
context:
space:
mode:
authorTobias Burnus <burnus@net-b.de>2009-07-11 02:03:07 +0200
committerTobias Burnus <burnus@gcc.gnu.org>2009-07-11 02:03:07 +0200
commit8d3681f9148b7aca65cb6f654d288799fc3efccf (patch)
tree4746f04967a90fa0d6480825a4967b65d5b8a994 /gcc/testsuite
parent98ac6510fa40424a33df9cd8fabb0cdc18e147e7 (diff)
downloadgcc-8d3681f9148b7aca65cb6f654d288799fc3efccf.zip
gcc-8d3681f9148b7aca65cb6f654d288799fc3efccf.tar.gz
gcc-8d3681f9148b7aca65cb6f654d288799fc3efccf.tar.bz2
re PR fortran/33197 (Fortran 2008: math functions)
2009-07-09 Tobias Burnus <burnus@net-b.de> PR fortran/33197 * check.c (gfc_check_fn_rc2008): New function. * intrinsic.h (gfc_check_fn_rc2008): New prototype. * intrinsic.c (add_functions): Add complex tan, cosh, sinh, and tanh. 2009-07-09 Tobias Burnus <burnus@net-b.de> PR fortran/33197 * gfortran.dg/complex_intrinsic_3.f90: New test. * gfortran.dg/complex_intrinsic_4.f90: New test. From-SVN: r149503
Diffstat (limited to 'gcc/testsuite')
-rw-r--r--gcc/testsuite/ChangeLog6
-rw-r--r--gcc/testsuite/gfortran.dg/complex_intrinsic_3.f9039
-rw-r--r--gcc/testsuite/gfortran.dg/complex_intrinsic_4.f9024
3 files changed, 69 insertions, 0 deletions
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 6a873c7..5cd90ab 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,9 @@
+2009-07-11 Tobias Burnus <burnus@net-b.de>
+
+ PR fortran/33197
+ * gfortran.dg/complex_intrinsic_3.f90: New test.
+ * gfortran.dg/complex_intrinsic_4.f90: New test.
+
2009-07-10 David Daney <ddaney@caviumnetworks.com>
PR target/39079
diff --git a/gcc/testsuite/gfortran.dg/complex_intrinsic_3.f90 b/gcc/testsuite/gfortran.dg/complex_intrinsic_3.f90
new file mode 100644
index 0000000..f0d12d6
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/complex_intrinsic_3.f90
@@ -0,0 +1,39 @@
+! { dg-do run }
+!
+! PR fortran/33197
+!
+! Fortran 2008 complex trigonometric functions: tan, cosh, sinh, tanh
+!
+implicit none
+real(4), parameter :: pi = 2*acos(0.0_4)
+real(8), parameter :: pi8 = 2*acos(0.0_8)
+real(4), parameter :: eps = 10*epsilon(0.0_4)
+real(8), parameter :: eps8 = 10*epsilon(0.0_8)
+complex(4), volatile :: z0_0 = cmplx(0.0_4, 0.0_4, kind=4)
+complex(4), volatile :: z1_1 = cmplx(1.0_4, 1.0_4, kind=4)
+complex(4), volatile :: zp_p = cmplx(pi, pi, kind=4)
+complex(8), volatile :: z80_0 = cmplx(0.0_8, 0.0_8, kind=8)
+complex(8), volatile :: z81_1 = cmplx(1.0_8, 1.0_8, kind=8)
+complex(8), volatile :: z8p_p = cmplx(pi8, pi8, kind=8)
+
+if (abs(tan(z0_0) - cmplx(0.0,0.0,4)) > eps) call abort()
+if (abs(tan(z1_1) - cmplx(0.27175257,1.0839232,4)) > eps) call abort()
+if (abs(tan(z80_0) - cmplx(0.0_8,0.0_8,8)) > eps8) call abort()
+if (abs(tan(z81_1) - cmplx(0.27175258531951174_8,1.0839233273386946_8,8)) > eps8) call abort()
+
+if (abs(cosh(z0_0) - cmplx(1.0,0.0,4)) > eps) call abort()
+if (abs(cosh(z1_1) - cmplx(0.83372992,0.98889768,4)) > eps) call abort()
+if (abs(cosh(z80_0) - cmplx(1.0_8,0.0_8,8)) > eps8) call abort()
+if (abs(cosh(z81_1) - cmplx(0.83373002513114913_8,0.98889770576286506_8,8)) > eps8) call abort()
+
+if (abs(sinh(z0_0) - cmplx(0.0,0.0,4)) > eps) call abort()
+if (abs(sinh(z1_1) - cmplx(0.63496387,1.2984575,4)) > eps) call abort()
+if (abs(sinh(z80_0) - cmplx(0.0_8,0.0_8,8)) > eps8) call abort()
+if (abs(sinh(z81_1) - cmplx(0.63496391478473613_8,1.2984575814159773_8,8)) > eps8) call abort()
+
+if (abs(tanh(z0_0) - cmplx(0.0,0.0,4)) > eps) call abort()
+if (abs(tanh(z1_1) - cmplx(1.0839232,0.27175257,4)) > eps) call abort()
+if (abs(tanh(z80_0) - cmplx(0.0_8,0.0_8,8)) > eps8) call abort()
+if (abs(tanh(z81_1) - cmplx(1.0839233273386946_8,0.27175258531951174_8,8)) > eps8) call abort()
+
+end
diff --git a/gcc/testsuite/gfortran.dg/complex_intrinsic_4.f90 b/gcc/testsuite/gfortran.dg/complex_intrinsic_4.f90
new file mode 100644
index 0000000..faef28f
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/complex_intrinsic_4.f90
@@ -0,0 +1,24 @@
+! { dg-do compile }
+! { dg-options "-std=f2003" }
+!
+! PR fortran/33197
+!
+! Fortran 2008 complex trigonometric functions: tan, cosh, sinh, tanh
+!
+real :: r
+complex :: z
+r = -45.5
+r = sin(r)
+r = cos(r)
+r = tan(r)
+r = cosh(r)
+r = sinh(r)
+r = tanh(r)
+z = 4.0
+z = cos(z)
+z = sin(z)
+z = tan(z) ! { dg-error "Fortran 2008: COMPLEX argument" }
+z = cosh(z)! { dg-error "Fortran 2008: COMPLEX argument" }
+z = sinh(z)! { dg-error "Fortran 2008: COMPLEX argument" }
+z = tanh(z)! { dg-error "Fortran 2008: COMPLEX argument" }
+end