summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gfortran.dg/iso_fortran_env_7.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/iso_fortran_env_7.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/iso_fortran_env_7.f90')
-rw-r--r--gcc/testsuite/gfortran.dg/iso_fortran_env_7.f9061
1 files changed, 61 insertions, 0 deletions
diff --git a/gcc/testsuite/gfortran.dg/iso_fortran_env_7.f90 b/gcc/testsuite/gfortran.dg/iso_fortran_env_7.f90
new file mode 100644
index 000000000..c8617efb1
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/iso_fortran_env_7.f90
@@ -0,0 +1,61 @@
+! { dg-do link }
+!
+! PR fortran/40571
+!
+! This test case adds check for the new Fortran 2008 array parameters
+! in ISO_FORTRAN_ENV: integer_kinds, logical_kinds, character_kinds,
+! and real_kinds.
+!
+! The test thus also checks that the values of the parameter are used
+! and no copy is made. (Cf. PR 44856.)
+
+program test
+ use iso_fortran_env, only: integer_kinds, character_kinds
+ implicit none
+ integer :: aaaa(2),i
+ i=1
+
+ print *, integer_kinds
+ print *, integer_kinds(1)
+ print *, (integer_kinds)
+ print *, (integer_kinds + 1)
+ print *, integer_kinds(1:2)
+ print *, integer_kinds(i)
+
+ aaaa = character_kinds
+ aaaa(1:2) = character_kinds(1:2)
+ aaaa(i) = character_kinds(i)
+ aaaa = character_kinds + 0
+ aaaa(1:2) = character_kinds(1:2) + 0
+ aaaa(i) = character_kinds(i) + 0
+end program test
+
+subroutine one()
+ use iso_fortran_env, only: ik => integer_kinds, ik2 => integer_kinds
+ implicit none
+
+ if (any (ik /= ik2)) call never_call_me()
+end subroutine one
+
+subroutine two()
+ use iso_fortran_env
+ implicit none
+
+ ! Should be 1, 2, 4, 8 and possibly 16
+ if (size (integer_kinds) < 4) call never_call_me()
+ if (any (integer_kinds(1:4) /= [1,2,4,8])) call never_call_me()
+ if (any (integer_kinds /= logical_kinds)) call never_call_me()
+
+ if (size (character_kinds) /= 2) call never_call_me()
+ if (any (character_kinds /= [1,4])) call never_call_me()
+
+ if (size (real_kinds) < 2) call never_call_me()
+ if (any (real_kinds(1:2) /= [4,8])) call never_call_me()
+end subroutine two
+
+subroutine three()
+ use iso_fortran_env
+ integer :: i, j(2)
+ i = real_kinds(1)
+ j = real_kinds(1:2)
+end subroutine three