Retro68/gcc/gcc/testsuite/gfortran.dg/selected_real_kind_2.f90

33 lines
785 B
Fortran
Raw Normal View History

2012-03-27 23:13:14 +00:00
! { dg-do run }
2018-12-28 15:30:48 +00:00
! { dg-options "-std=f2008 " }
2012-03-27 23:13:14 +00:00
!
integer :: p, r, rdx
! Compile-time version
if (selected_real_kind(radix=2) /= 4) call should_not_fail()
if (selected_real_kind(radix=4) /= -5) call should_not_fail()
if (selected_real_kind(precision(0.0),range(0.0),radix(0.0)) /= kind(0.0)) &
call should_not_fail()
if (selected_real_kind(precision(0.0d0),range(0.0d0),radix(0.0d0)) /= kind(0.0d0)) &
call should_not_fail()
! Run-time version
rdx = 2
2018-12-28 15:30:48 +00:00
if (selected_real_kind(radix=rdx) /= 4) STOP 1
2012-03-27 23:13:14 +00:00
rdx = 4
2018-12-28 15:30:48 +00:00
if (selected_real_kind(radix=rdx) /= -5) STOP 2
2012-03-27 23:13:14 +00:00
rdx = radix(0.0)
p = precision(0.0)
r = range(0.0)
2018-12-28 15:30:48 +00:00
if (selected_real_kind(p,r,rdx) /= kind(0.0)) STOP 3
2012-03-27 23:13:14 +00:00
rdx = radix(0.0d0)
p = precision(0.0d0)
r = range(0.0d0)
2018-12-28 15:30:48 +00:00
if (selected_real_kind(p,r,rdx) /= kind(0.0d0)) STOP 4
2012-03-27 23:13:14 +00:00
end