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/minmax_char_1.f90 | 73 +++++++++++++++++++++++++++++ 1 file changed, 73 insertions(+) create mode 100644 gcc/testsuite/gfortran.dg/minmax_char_1.f90 (limited to 'gcc/testsuite/gfortran.dg/minmax_char_1.f90') diff --git a/gcc/testsuite/gfortran.dg/minmax_char_1.f90 b/gcc/testsuite/gfortran.dg/minmax_char_1.f90 new file mode 100644 index 000000000..9e73e9850 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/minmax_char_1.f90 @@ -0,0 +1,73 @@ +! Tests for MIN and MAX intrinsics with character arguments +! +! { dg-do run } +program test + character(len=3), parameter :: sp = "gee" + character(len=6), parameter :: tp = "crunch", wp = "flunch" + character(len=2), parameter :: up = "az", vp = "da" + + character(len=3) :: s + character(len=6) :: t, w + character(len=2) :: u, v + s = "gee" + t = "crunch" + u = "az" + v = "da" + w = "flunch" + + if (.not. equal(min("foo", "bar"), "bar")) call abort + if (.not. equal(max("foo", "bar"), "foo")) call abort + if (.not. equal(min("bar", "foo"), "bar")) call abort + if (.not. equal(max("bar", "foo"), "foo")) call abort + + if (.not. equal(min("bar", "foo", sp), "bar")) call abort + if (.not. equal(max("bar", "foo", sp), "gee")) call abort + if (.not. equal(min("bar", sp, "foo"), "bar")) call abort + if (.not. equal(max("bar", sp, "foo"), "gee")) call abort + if (.not. equal(min(sp, "bar", "foo"), "bar")) call abort + if (.not. equal(max(sp, "bar", "foo"), "gee")) call abort + + if (.not. equal(min("foo", "bar", s), "bar")) call abort + if (.not. equal(max("foo", "bar", s), "gee")) call abort + if (.not. equal(min("foo", s, "bar"), "bar")) call abort + if (.not. equal(max("foo", s, "bar"), "gee")) call abort + if (.not. equal(min(s, "foo", "bar"), "bar")) call abort + if (.not. equal(max(s, "foo", "bar"), "gee")) call abort + + if (.not. equal(min("", ""), "")) call abort + if (.not. equal(max("", ""), "")) call abort + if (.not. equal(min("", " "), " ")) call abort + if (.not. equal(max("", " "), " ")) call abort + + if (.not. equal(min(u,v,w), "az ")) call abort + if (.not. equal(max(u,v,w), "flunch")) call abort + if (.not. equal(min(u,vp,w), "az ")) call abort + if (.not. equal(max(u,vp,w), "flunch")) call abort + if (.not. equal(min(u,v,wp), "az ")) call abort + if (.not. equal(max(u,v,wp), "flunch")) call abort + if (.not. equal(min(up,v,w), "az ")) call abort + if (.not. equal(max(up,v,w), "flunch")) call abort + + call foo("gee ","az ",s,t,u,v) + call foo("gee ","az ",s,t,u,v) + call foo("gee ","az ",s,t,u) + call foo("gee ","crunch",s,t) + +contains + + subroutine foo(res_max, res_min, a, b, c, d) + character(len=*) :: res_min, res_max + character(len=*), optional :: a, b, c, d + + if (.not. equal(min(a,b,c,d), res_min)) call abort + if (.not. equal(max(a,b,c,d), res_max)) call abort + end subroutine foo + + pure function equal(a,b) + character(len=*), intent(in) :: a, b + logical :: equal + + equal = (len(a) == len(b)) .and. (a == b) + end function equal + +end program test -- cgit v1.2.3