1! { dg-do run } 2! { dg-additional-options "-fcoarray=single -fdump-tree-original" } 3! 4! Check that {L,U}{,CO}BOUND intrinsics are properly simplified. 5! 6 implicit none 7 8 type :: t 9 integer :: c 10 end type t 11 12 type(t) :: d(3:8) = t(7) 13 type(t) :: e[5:9,-1:*] 14 type(t) :: h(3), j(4), k(0) 15 16 !Test full arrays vs subarrays 17 if (lbound(d, 1) /= 3) STOP 1 18 if (lbound(d(3:5), 1) /= 1) STOP 2 19 if (lbound(d%c, 1) /= 1) STOP 3 20 if (ubound(d, 1) /= 8) STOP 4 21 if (ubound(d(3:5), 1) /= 3) STOP 5 22 if (ubound(d%c, 1) /= 6) STOP 6 23 24 if (lcobound(e, 1) /= 5) STOP 7 25 if (lcobound(e%c, 1) /= 5) STOP 8 26 if (lcobound(e, 2) /= -1) STOP 9 27 if (lcobound(e%c, 2) /= -1) STOP 10 28 if (ucobound(e, 1) /= 9) STOP 11 29 if (ucobound(e%c, 1) /= 9) STOP 12 30 ! no simplification for ucobound(e{,%c}, dim=2) 31 32 if (any(lbound(d ) /= [3])) STOP 13 33 if (any(lbound(d(3:5)) /= [1])) STOP 14 34 if (any(lbound(d%c ) /= [1])) STOP 15 35 if (any(ubound(d ) /= [8])) STOP 16 36 if (any(ubound(d(3:5)) /= [3])) STOP 17 37 if (any(ubound(d%c ) /= [6])) STOP 18 38 39 if (any(lcobound(e ) /= [5, -1])) STOP 19 40 if (any(lcobound(e%c) /= [5, -1])) STOP 20 41 ! no simplification for ucobound(e{,%c}) 42 43 call test_empty_arrays(h, j, k) 44 45contains 46 subroutine test_empty_arrays(a, c, d) 47 type(t) :: a(:), c(-3:0), d(3:1) 48 type(t) :: f(4:2), g(0:6) 49 50 if (lbound(a, 1) /= 1) STOP 21 51 if (lbound(c, 1) /= -3) STOP 22 52 if (lbound(d, 1) /= 1) STOP 23 53 if (lbound(f, 1) /= 1) STOP 24 54 if (lbound(g, 1) /= 0) STOP 25 55 56 if (ubound(c, 1) /= 0) STOP 26 57 if (ubound(d, 1) /= 0) STOP 27 58 if (ubound(f, 1) /= 0) STOP 28 59 if (ubound(g, 1) /= 6) STOP 29 60 61 if (any(lbound(a) /= [ 1])) STOP 30 62 if (any(lbound(c) /= [-3])) STOP 31 63 if (any(lbound(d) /= [ 1])) STOP 32 64 if (any(lbound(f) /= [ 1])) STOP 33 65 if (any(lbound(g) /= [ 0])) STOP 34 66 67 if (any(ubound(c) /= [0])) STOP 35 68 if (any(ubound(d) /= [0])) STOP 36 69 if (any(ubound(f) /= [0])) STOP 37 70 if (any(ubound(g) /= [6])) STOP 38 71 72 end subroutine 73end 74! { dg-final { scan-tree-dump-not "_gfortran_stop" "original" } } 75