summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gfortran.dg/intrinsic_spread_2.f90
diff options
context:
space:
mode:
authorupstream source tree <ports@midipix.org>2015-03-15 20:14:05 -0400
committerupstream source tree <ports@midipix.org>2015-03-15 20:14:05 -0400
commit554fd8c5195424bdbcabf5de30fdc183aba391bd (patch)
tree976dc5ab7fddf506dadce60ae936f43f58787092 /gcc/testsuite/gfortran.dg/intrinsic_spread_2.f90
downloadcbb-gcc-4.6.4-554fd8c5195424bdbcabf5de30fdc183aba391bd.tar.bz2
cbb-gcc-4.6.4-554fd8c5195424bdbcabf5de30fdc183aba391bd.tar.xz
obtained gcc-4.6.4.tar.bz2 from upstream website;upstream
verified gcc-4.6.4.tar.bz2.sig; imported gcc-4.6.4 source tree from verified upstream tarball. downloading a git-generated archive based on the 'upstream' tag should provide you with a source tree that is binary identical to the one extracted from the above tarball. if you have obtained the source via the command 'git clone', however, do note that line-endings of files in your working directory might differ from line-endings of the respective files in the upstream repository.
Diffstat (limited to 'gcc/testsuite/gfortran.dg/intrinsic_spread_2.f90')
-rw-r--r--gcc/testsuite/gfortran.dg/intrinsic_spread_2.f9051
1 files changed, 51 insertions, 0 deletions
diff --git a/gcc/testsuite/gfortran.dg/intrinsic_spread_2.f90 b/gcc/testsuite/gfortran.dg/intrinsic_spread_2.f90
new file mode 100644
index 000000000..0a91be7b5
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/intrinsic_spread_2.f90
@@ -0,0 +1,51 @@
+! { dg-do run }
+! { dg-require-effective-target fortran_large_real }
+program foo
+ implicit none
+ integer,parameter :: k = selected_real_kind (precision (0.0_8) + 1)
+
+ real(kind=k), dimension(10) :: r_k
+ real(kind=k), dimension (2, 3) :: ar_k
+ real(kind=k), dimension (2, 2, 3) :: br_k
+ complex(kind=k), dimension(10) :: c_k
+ complex(kind=k), dimension (2, 3) :: ac_k
+ complex(kind=k), dimension (2, 2, 3) :: bc_k
+ character (len=200) line1, line2, line3
+
+ ar_k = reshape ((/1._k, 2._k, 3._k, 4._k, 5._k, 6._k/), (/2, 3/))
+ br_k = spread (ar_k, 1, 2)
+ if (any (br_k .ne. reshape ((/1._k, 1._k, 2._k, 2._k, 3._k, 3._k, &
+ & 4._k, 4._k, 5._k, 5._k, 6._k, 6._k/), (/2, 2, 3/)))) call abort
+ line1 = ' '
+ write(line1, 9010) br_k
+ line2 = ' '
+ write(line2, 9010) spread (ar_k, 1, 2)
+ if (line1 /= line2) call abort
+ line3 = ' '
+ write(line3, 9010) spread (ar_k, 1, 2) + 0._k
+ if (line1 /= line3) call abort
+ r_k = spread(1._k,1,10)
+ if (any(r_k /= 1._k)) call abort
+
+ ac_k = reshape ((/(1._k,-1._k), (2._k,-2._k), (3._k, -3._k), (4._k, -4._k), &
+ & (5._k,-5._k), (6._k,-6._k)/), (/2, 3/))
+ bc_k = spread (ac_k, 1, 2)
+ if (any (real(bc_k) .ne. reshape ((/1._k, 1._k, 2._k, 2._k, 3._k, 3._k, &
+ & 4._k, 4._k, 5._k, 5._k, 6._k, 6._k/), (/2, 2, 3/)))) call abort
+ if (any (-aimag(bc_k) .ne. reshape ((/1._k, 1._k, 2._k, 2._k, 3._k, 3._k, &
+ & 4._k, 4._k, 5._k, 5._k, 6._k, 6._k/), (/2, 2, 3/)))) call abort
+ line1 = ' '
+ write(line1, 9020) bc_k
+ line2 = ' '
+ write(line2, 9020) spread (ac_k, 1, 2)
+ if (line1 /= line2) call abort
+ line3 = ' '
+ write(line3, 9020) spread (ac_k, 1, 2) + 0._k
+ if (line1 /= line3) call abort
+ c_k = spread((1._k,-1._k),1,10)
+ if (any(c_k /= (1._k,-1._k))) call abort
+
+9010 format(12F7.3)
+9020 format(25F7.3)
+
+end program