From 554fd8c5195424bdbcabf5de30fdc183aba391bd Mon Sep 17 00:00:00 2001 From: upstream source tree Date: Sun, 15 Mar 2015 20:14:05 -0400 Subject: obtained gcc-4.6.4.tar.bz2 from upstream website; 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. --- gcc/testsuite/gfortran.dg/reduction.f90 | 85 +++++++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) create mode 100644 gcc/testsuite/gfortran.dg/reduction.f90 (limited to 'gcc/testsuite/gfortran.dg/reduction.f90') diff --git a/gcc/testsuite/gfortran.dg/reduction.f90 b/gcc/testsuite/gfortran.dg/reduction.f90 new file mode 100644 index 000000000..82193542f --- /dev/null +++ b/gcc/testsuite/gfortran.dg/reduction.f90 @@ -0,0 +1,85 @@ +! { dg-do run } +! PR 16946 +! Not all allowed combinations of arguments for MAXVAL, MINVAL, +! PRODUCT and SUM were supported. +program reduction_mask + implicit none + logical :: equal(3) + + integer, parameter :: res(4*9) = (/ 3, 3, 3, 2, 2, 2, 2, 2, 2, 1, 1, 1, 1, & + 1, 1, 1, 1, 1, 6, 6, 6, 2, 2, 2, 2, 2, 2, 6, 6, 6, 3, 3, 3, 3, 3, 3 /) + integer :: val(4*9) + complex :: cval(2*9), cin(3) + + equal = (/ .true., .true., .false. /) + + ! use all combinations of the dim and mask arguments for the + ! reduction intrinsics + val( 1) = maxval((/ 1, 2, 3 /)) + val( 2) = maxval((/ 1, 2, 3 /), 1) + val( 3) = maxval((/ 1, 2, 3 /), dim=1) + val( 4) = maxval((/ 1, 2, 3 /), equal) + val( 5) = maxval((/ 1, 2, 3 /), mask=equal) + val( 6) = maxval((/ 1, 2, 3 /), 1, equal) + val( 7) = maxval((/ 1, 2, 3 /), 1, mask=equal) + val( 8) = maxval((/ 1, 2, 3 /), dim=1, mask=equal) + val( 9) = maxval((/ 1, 2, 3 /), mask=equal, dim=1) + + val(10) = minval((/ 1, 2, 3 /)) + val(11) = minval((/ 1, 2, 3 /), 1) + val(12) = minval((/ 1, 2, 3 /), dim=1) + val(13) = minval((/ 1, 2, 3 /), equal) + val(14) = minval((/ 1, 2, 3 /), mask=equal) + val(15) = minval((/ 1, 2, 3 /), 1, equal) + val(16) = minval((/ 1, 2, 3 /), 1, mask=equal) + val(17) = minval((/ 1, 2, 3 /), dim=1, mask=equal) + val(18) = minval((/ 1, 2, 3 /), mask=equal, dim=1) + + val(19) = product((/ 1, 2, 3 /)) + val(20) = product((/ 1, 2, 3 /), 1) + val(21) = product((/ 1, 2, 3 /), dim=1) + val(22) = product((/ 1, 2, 3 /), equal) + val(23) = product((/ 1, 2, 3 /), mask=equal) + val(24) = product((/ 1, 2, 3 /), 1, equal) + val(25) = product((/ 1, 2, 3 /), 1, mask=equal) + val(26) = product((/ 1, 2, 3 /), dim=1, mask=equal) + val(27) = product((/ 1, 2, 3 /), mask=equal, dim=1) + + val(28) = sum((/ 1, 2, 3 /)) + val(29) = sum((/ 1, 2, 3 /), 1) + val(30) = sum((/ 1, 2, 3 /), dim=1) + val(31) = sum((/ 1, 2, 3 /), equal) + val(32) = sum((/ 1, 2, 3 /), mask=equal) + val(33) = sum((/ 1, 2, 3 /), 1, equal) + val(34) = sum((/ 1, 2, 3 /), 1, mask=equal) + val(35) = sum((/ 1, 2, 3 /), dim=1, mask=equal) + val(36) = sum((/ 1, 2, 3 /), mask=equal, dim=1) + + if (any (val /= res)) call abort + + ! Tests for complex arguments. These were broken by the original fix. + + cin = cmplx((/1,2,3/)) + + cval(1) = product(cin) + cval(2) = product(cin, 1) + cval(3) = product(cin, dim=1) + cval(4) = product(cin, equal) + cval(5) = product(cin, mask=equal) + cval(6) = product(cin, 1, equal) + cval(7) = product(cin, 1, mask=equal) + cval(8) = product(cin, dim=1, mask=equal) + cval(9) = product(cin, mask=equal, dim=1) + + cval(10) = sum(cin) + cval(11) = sum(cin, 1) + cval(12) = sum(cin, dim=1) + cval(13) = sum(cin, equal) + cval(14) = sum(cin, mask=equal) + cval(15) = sum(cin, 1, equal) + cval(16) = sum(cin, 1, mask=equal) + cval(17) = sum(cin, dim=1, mask=equal) + cval(18) = sum(cin, mask=equal, dim=1) + + if (any (cval /= cmplx(res(19:36)))) call abort +end program reduction_mask -- cgit v1.2.3