! { dg-do run } ! Check that simplificiation of ubound is done. ! { dg-options "-O -fdump-tree-original -fdump-tree-optimized" } module bar implicit none contains subroutine foo(a, b, n, m) integer, dimension(:), intent(inout) :: a integer, dimension(-2:), intent(inout) :: b integer, intent(out) :: n,m n = lbound(a,1) m = lbound(b,1) end subroutine foo end module bar program main use bar implicit none integer, dimension(3) :: a, b integer :: n,m call foo(a,b,n,m) if (n .ne. 1 .or. m .ne. -2) call abort end program main ! { dg-final { scan-tree-dump-times "\\*n = 1" 1 "original" } } ! { dg-final { scan-tree-dump-times "\\*m = -2" 1 "original" } } ! { dg-final { scan-tree-dump-times "lbound" 0 "optimized" } } ! { dg-final { cleanup-tree-dump "original" } } ! { dg-final { cleanup-tree-dump "optimized" } }