aboutsummaryrefslogtreecommitdiffstats
path: root/gcc-4.9/gcc/testsuite/gfortran.dg/power1.f90
diff options
context:
space:
mode:
authorBen Cheng <bccheng@google.com>2014-03-25 22:37:19 -0700
committerBen Cheng <bccheng@google.com>2014-03-25 22:37:19 -0700
commit1bc5aee63eb72b341f506ad058502cd0361f0d10 (patch)
treec607e8252f3405424ff15bc2d00aa38dadbb2518 /gcc-4.9/gcc/testsuite/gfortran.dg/power1.f90
parent283a0bf58fcf333c58a2a92c3ebbc41fb9eb1fdb (diff)
downloadtoolchain_gcc-1bc5aee63eb72b341f506ad058502cd0361f0d10.tar.gz
toolchain_gcc-1bc5aee63eb72b341f506ad058502cd0361f0d10.tar.bz2
toolchain_gcc-1bc5aee63eb72b341f506ad058502cd0361f0d10.zip
Initial checkin of GCC 4.9.0 from trunk (r208799).
Change-Id: I48a3c08bb98542aa215912a75f03c0890e497dba
Diffstat (limited to 'gcc-4.9/gcc/testsuite/gfortran.dg/power1.f90')
-rw-r--r--gcc-4.9/gcc/testsuite/gfortran.dg/power1.f9058
1 files changed, 58 insertions, 0 deletions
diff --git a/gcc-4.9/gcc/testsuite/gfortran.dg/power1.f90 b/gcc-4.9/gcc/testsuite/gfortran.dg/power1.f90
new file mode 100644
index 000000000..50dbac275
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/gfortran.dg/power1.f90
@@ -0,0 +1,58 @@
+! { dg-do run }
+! Test fix for PR fortran/38823.
+program power
+
+ implicit none
+
+ integer, parameter :: &
+ & s = kind(1.e0), &
+ & d = kind(1.d0), &
+ & e = max(selected_real_kind(precision(1.d0)+1), d)
+
+ real(s), parameter :: ris = 2.e0_s**2
+ real(d), parameter :: rid = 2.e0_d**2
+ real(e), parameter :: rie = 2.e0_e**2
+ complex(s), parameter :: cis = (2.e0_s,1.e0_s)**2
+ complex(d), parameter :: cid = (2.e0_d,1.e0_d)**2
+ complex(e), parameter :: cie = (2.e0_e,1.e0_e)**2
+
+ real(s), parameter :: rrs = 2.e0_s**2.e0
+ real(d), parameter :: rrd = 2.e0_d**2.e0
+ real(e), parameter :: rre = 2.e0_e**2.e0
+ complex(s), parameter :: crs = (2.e0_s,1.e0_s)**2.e0
+ complex(d), parameter :: crd = (2.e0_d,1.e0_d)**2.e0
+ complex(e), parameter :: cre = (2.e0_e,1.e0_e)**2.e0
+
+ real(s), parameter :: rds = 2.e0_s**2.e0_d
+ real(d), parameter :: rdd = 2.e0_d**2.e0_d
+ real(e), parameter :: rde = 2.e0_e**2.e0_d
+ complex(s), parameter :: cds = (2.e0_s,1.e0_s)**2.e0_d
+ complex(d), parameter :: cdd = (2.e0_d,1.e0_d)**2.e0_d
+ complex(e), parameter :: cde = (2.e0_e,1.e0_e)**2.e0_d
+
+ real(s), parameter :: eps_s = 1.e-5_s
+ real(d), parameter :: eps_d = 1.e-10_d
+ real(e), parameter :: eps_e = 1.e-10_e
+
+ if (abs(ris - 4) > eps_s) call abort
+ if (abs(rid - 4) > eps_d) call abort
+ if (abs(rie - 4) > eps_e) call abort
+ if (abs(real(cis, s) - 3) > eps_s .or. abs(aimag(cis) - 4) > eps_s) call abort
+ if (abs(real(cid, d) - 3) > eps_d .or. abs(aimag(cid) - 4) > eps_d) call abort
+ if (abs(real(cie, e) - 3) > eps_e .or. abs(aimag(cie) - 4) > eps_e) call abort
+
+ if (abs(rrs - 4) > eps_s) call abort
+ if (abs(rrd - 4) > eps_d) call abort
+ if (abs(rre - 4) > eps_e) call abort
+ if (abs(real(crs, s) - 3) > eps_s .or. abs(aimag(crs) - 4) > eps_s) call abort
+ if (abs(real(crd, d) - 3) > eps_d .or. abs(aimag(crd) - 4) > eps_d) call abort
+ if (abs(real(cre, e) - 3) > eps_e .or. abs(aimag(cre) - 4) > eps_e) call abort
+
+ if (abs(rds - 4) > eps_s) call abort
+ if (abs(rdd - 4) > eps_d) call abort
+ if (abs(rde - 4) > eps_e) call abort
+ if (abs(real(cds, s) - 3) > eps_s .or. abs(aimag(cds) - 4) > eps_s) call abort
+ if (abs(real(cdd, d) - 3) > eps_d .or. abs(aimag(cdd) - 4) > eps_d) call abort
+ if (abs(real(cde, e) - 3) > eps_e .or. abs(aimag(cde) - 4) > eps_e) call abort
+
+end program power