OpenCores
URL https://opencores.org/ocsvn/openrisc_2011-10-31/openrisc_2011-10-31/trunk

Subversion Repositories openrisc_2011-10-31

[/] [openrisc/] [tags/] [gnu-src/] [gcc-4.5.1/] [gcc-4.5.1-or32-1.0rc2/] [gcc/] [testsuite/] [gfortran.fortran-torture/] [execute/] [intrinsic_pack.f90] - Diff between revs 303 and 384

Only display areas with differences | Details | Blame | View Log

Rev 303 Rev 384
! Program to test the PACK intrinsic
! Program to test the PACK intrinsic
program intrinsic_pack
program intrinsic_pack
   integer, parameter :: val(9) = (/0,0,0,0,9,0,0,0,7/)
   integer, parameter :: val(9) = (/0,0,0,0,9,0,0,0,7/)
   integer, dimension(3, 3) :: a
   integer, dimension(3, 3) :: a
   integer, dimension(6) :: b
   integer, dimension(6) :: b
   a = reshape (val, (/3, 3/))
   a = reshape (val, (/3, 3/))
   b = 0
   b = 0
   b(1:6:3) = pack (a, a .ne. 0);
   b(1:6:3) = pack (a, a .ne. 0);
   if (any (b(1:6:3) .ne. (/9, 7/))) call abort
   if (any (b(1:6:3) .ne. (/9, 7/))) call abort
   b = pack (a(2:3, 2:3), a(2:3, 2:3) .ne. 0, (/1, 2, 3, 4, 5, 6/));
   b = pack (a(2:3, 2:3), a(2:3, 2:3) .ne. 0, (/1, 2, 3, 4, 5, 6/));
   if (any (b .ne. (/9, 7, 3, 4, 5, 6/))) call abort
   if (any (b .ne. (/9, 7, 3, 4, 5, 6/))) call abort
   call tests_with_temp()
   call tests_with_temp()
contains
contains
  subroutine tests_with_temp
  subroutine tests_with_temp
    ! A few tests which involve a temporary
    ! A few tests which involve a temporary
    if (any (pack(a, a.ne.0) .ne. (/9, 7/))) call abort
    if (any (pack(a, a.ne.0) .ne. (/9, 7/))) call abort
    if (any (pack(a, .true.) .ne. val)) call abort
    if (any (pack(a, .true.) .ne. val)) call abort
    if (size(pack (a, .false.)) .ne. 0) call abort
    if (size(pack (a, .false.)) .ne. 0) call abort
    if (any (pack(a, .false., (/1,2,3/)).ne. (/1,2,3/))) call abort
    if (any (pack(a, .false., (/1,2,3/)).ne. (/1,2,3/))) call abort
  end subroutine tests_with_temp
  end subroutine tests_with_temp
end program
end program
 
 

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.