summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gfortran.dg/maxlocval_1.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/maxlocval_1.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/maxlocval_1.f90')
-rw-r--r--gcc/testsuite/gfortran.dg/maxlocval_1.f9044
1 files changed, 44 insertions, 0 deletions
diff --git a/gcc/testsuite/gfortran.dg/maxlocval_1.f90 b/gcc/testsuite/gfortran.dg/maxlocval_1.f90
new file mode 100644
index 000000000..11a92ca77
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/maxlocval_1.f90
@@ -0,0 +1,44 @@
+! { dg-do run }
+! Check that maxval uses for integers HUGE()-1.
+! PR fortran/30512
+
+program main
+implicit none
+integer(1) :: i1(3), a1(3:2)
+integer(2) :: i2(3), a2(3:2)
+integer(4) :: i4(3), a4(3:2)
+integer(8) :: i8(3), a8(3:2)
+
+integer(kind=4), allocatable :: a(:,:)
+integer(kind=8), allocatable :: b(:,:)
+
+logical :: msk(3)
+msk = .false.
+
+i1 = 1
+i2 = 1
+i4 = 1
+i8 = 1
+
+if(-huge(i1)-1_1 /= maxval(i1, msk)) call abort() ! { dg-warning "outside symmetric range implied by Standard Fortran" }
+if(-huge(a1)-1_1 /= maxval(a1)) call abort() ! { dg-warning "outside symmetric range implied by Standard Fortran" }
+
+if(-huge(i2)-1_2 /= maxval(i2, msk)) call abort() ! { dg-warning "outside symmetric range implied by Standard Fortran" }
+if(-huge(a2)-1_2 /= maxval(a2)) call abort() ! { dg-warning "outside symmetric range implied by Standard Fortran" }
+
+if(-huge(i4)-1_4 /= maxval(i4, msk)) call abort() ! { dg-warning "outside symmetric range implied by Standard Fortran" }
+if(-huge(a4)-1_4 /= maxval(a4)) call abort() ! { dg-warning "outside symmetric range implied by Standard Fortran" }
+
+if(-huge(i8)-1_4 /= maxval(i8, msk)) call abort() ! { dg-warning "outside symmetric range implied by Standard Fortran" }
+if(-huge(a8)-1_4 /= maxval(a8)) call abort() ! { dg-warning "outside symmetric range implied by Standard Fortran" }
+
+allocate (a(0:-1,1:1))
+allocate (b(0:-1,1:1))
+
+if(any(maxval(a,dim=1) /= -huge(a)-1_4)) call abort() ! { dg-warning "outside symmetric range implied by Standard Fortran" }
+if(any(minval(a,dim=1) /= huge(a) )) call abort()
+
+if(any(maxval(b,dim=1) /= -huge(b)-1_8)) call abort() ! { dg-warning "outside symmetric range implied by Standard Fortran" }
+if(any(minval(b,dim=1) /= huge(b) )) call abort()
+
+end program main