URL
https://opencores.org/ocsvn/openrisc_2011-10-31/openrisc_2011-10-31/trunk
Subversion Repositories openrisc_2011-10-31
[/] [openrisc/] [trunk/] [gnu-src/] [gcc-4.5.1/] [gcc/] [testsuite/] [gfortran.dg/] [intrinsic_pack_2.f90] - Rev 302
Compare with Previous | Blame | View Log
! { dg-do run }
! { dg-require-effective-target fortran_large_real }
! Take the pack intrinsic through its paces, with all types that are
! normally accessible.
program main
implicit none
integer,parameter :: k = selected_real_kind (precision (0.0_8) + 1)
integer :: i
real(kind=k), dimension(3,3) :: rk
real(kind=k), dimension(9) :: vrk
real(kind=k), dimension(9) :: rrk
complex(kind=k), dimension(3,3) :: ck
complex(kind=k), dimension(9) :: vck
complex(kind=k), dimension(9) :: rck
vrk = (/(i+10,i=1,9)/)
rk = reshape((/1.0_k, -3.0_k, 2.1_k, -4.21_k, 1.2_k, 0.98_k, -1.2_k, &
& -7.1_k, -9.9_k, 0.3_k /), shape(rk))
rrk = pack(rk,rk>0,vrk)
if (any(rrk /= (/ 1.0_k, 2.1_k, 1.2_k, 0.98_k, 15._k, 16._k, 17._k, &
& 18._k, 19._k /))) call abort
vck = (/(i+10,i=1,9)/)
ck = reshape((/1.0_k, -3.0_k, 2.1_k, -4.21_k, 1.2_k, 0.98_k, -1.2_k, &
& -7.1_k, -9.9_k, 0.3_k /), shape(ck))
rck = pack(ck,real(ck)>0,vck)
if (any(real(rck) /= (/ 1.0_k, 2.1_k, 1.2_k, 0.98_k, 15._k, 16._k, 17._k, &
& 18._k, 19._k /))) call abort
if (any(aimag(rck) /= 0)) call abort
end program main