| 1 | ! audit31: explicit-shape dummy xs(n), where n is a dummy argument, |
| 2 | ! used to emit bounds check (1,1) instead of (1,n) because |
| 3 | ! arg_dims_from_decls fell back when the upper-bound expr wasn't |
| 4 | ! const-foldable. install_runtime_dim_bounds now lowers the bound |
| 5 | ! at function entry; compute_flat_elem_offset consults it for the |
| 6 | ! bounds-check upper and cumulative stride. Task #483. |
| 7 | ! CHECK: 150 |
| 8 | program audit31_explicit_shape_bounds |
| 9 | implicit none |
| 10 | integer :: xs(5), total |
| 11 | xs = (/10, 20, 30, 40, 50/) |
| 12 | call sum5(xs, 5, total) |
| 13 | print *, total |
| 14 | contains |
| 15 | subroutine sum5(xs, n, r) |
| 16 | integer, intent(in) :: n, xs(n) |
| 17 | integer, intent(out) :: r |
| 18 | integer :: i |
| 19 | r = 0 |
| 20 | do i = 1, n |
| 21 | r = r + xs(i) |
| 22 | end do |
| 23 | end subroutine |
| 24 | end program |
| 25 |