summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gfortran.dg/widechar_intrinsics_9.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/widechar_intrinsics_9.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/widechar_intrinsics_9.f90')
-rw-r--r--gcc/testsuite/gfortran.dg/widechar_intrinsics_9.f9070
1 files changed, 70 insertions, 0 deletions
diff --git a/gcc/testsuite/gfortran.dg/widechar_intrinsics_9.f90 b/gcc/testsuite/gfortran.dg/widechar_intrinsics_9.f90
new file mode 100644
index 000000000..ca6fa5818
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/widechar_intrinsics_9.f90
@@ -0,0 +1,70 @@
+! { dg-do run }
+! { dg-options "-fbackslash" }
+
+ implicit none
+ character(kind=1,len=3) :: s1, t1
+ character(kind=4,len=3) :: s4, t4
+
+ s1 = "foo" ; t1 = "bar"
+ call check_minmax_1 ("foo", "bar", min("foo","bar"), max("foo","bar"))
+ call check_minmax_1 ("bar", "foo", min("foo","bar"), max("foo","bar"))
+ call check_minmax_1 (s1, t1, min(s1,t1), max(s1,t1))
+ call check_minmax_1 (t1, s1, min(s1,t1), max(s1,t1))
+
+ s1 = " " ; t1 = "bar"
+ call check_minmax_1 (" ", "bar", min(" ","bar"), max(" ","bar"))
+ call check_minmax_1 ("bar", " ", min(" ","bar"), max(" ","bar"))
+ call check_minmax_1 (s1, t1, min(s1,t1), max(s1,t1))
+ call check_minmax_1 (t1, s1, min(s1,t1), max(s1,t1))
+
+ s1 = " " ; t1 = " "
+ call check_minmax_1 (" ", " ", min(" "," "), max(" "," "))
+ call check_minmax_1 (" ", " ", min(" "," "), max(" "," "))
+ call check_minmax_1 (s1, t1, min(s1,t1), max(s1,t1))
+ call check_minmax_1 (t1, s1, min(s1,t1), max(s1,t1))
+
+ s1 = "d\xFF " ; t1 = "d "
+ call check_minmax_1 ("d\xFF ", "d ", min("d\xFF ","d "), max("d\xFF ","d "))
+ call check_minmax_1 ("d ", "d\xFF ", min("d\xFF ","d "), max("d\xFF ","d "))
+ call check_minmax_1 (s1, t1, min(s1,t1), max(s1,t1))
+ call check_minmax_1 (t1, s1, min(s1,t1), max(s1,t1))
+
+ s4 = 4_" " ; t4 = 4_"xxx"
+ call check_minmax_2 (4_" ", 4_"xxx", min(4_" ", 4_"xxx"), &
+ max(4_" ", 4_"xxx"))
+ call check_minmax_2 (4_"xxx", 4_" ", min(4_" ", 4_"xxx"), &
+ max(4_" ", 4_"xxx"))
+ call check_minmax_2 (s4, t4, min(s4,t4), max(s4,t4))
+ call check_minmax_2 (t4, s4, min(s4,t4), max(s4,t4))
+
+ s4 = 4_" \u1be3m" ; t4 = 4_"xxx"
+ call check_minmax_2 (4_" \u1be3m", 4_"xxx", min(4_" \u1be3m", 4_"xxx"), &
+ max(4_" \u1be3m", 4_"xxx"))
+ call check_minmax_2 (4_"xxx", 4_" \u1be3m", min(4_" \u1be3m", 4_"xxx"), &
+ max(4_" \u1be3m", 4_"xxx"))
+ call check_minmax_2 (s4, t4, min(s4,t4), max(s4,t4))
+ call check_minmax_2 (t4, s4, min(s4,t4), max(s4,t4))
+
+contains
+
+ subroutine check_minmax_1 (s1, s2, smin, smax)
+ implicit none
+ character(kind=1,len=*), intent(in) :: s1, s2, smin, smax
+ character(kind=4,len=len(s1)) :: w1, w2, wmin, wmax
+
+ w1 = s1 ; w2 = s2 ; wmin = smin ; wmax = smax
+ if (min (w1, w2) /= wmin) call abort
+ if (max (w1, w2) /= wmax) call abort
+ if (min (s1, s2) /= smin) call abort
+ if (max (s1, s2) /= smax) call abort
+ end subroutine check_minmax_1
+
+ subroutine check_minmax_2 (s1, s2, smin, smax)
+ implicit none
+ character(kind=4,len=*), intent(in) :: s1, s2, smin, smax
+
+ if (min (s1, s2) /= smin) call abort
+ if (max (s1, s2) /= smax) call abort
+ end subroutine check_minmax_2
+
+end