| 1 |
! { dg-do run } |
| 2 |
! { dg-additional-options "-fcheck=bounds -ffrontend-optimize" } |
| 3 |
! PR 85631 - this used to cause a runtime error with bounds checking. |
| 4 |
module x |
| 5 |
contains |
| 6 |
subroutine sub(a, b) |
| 7 |
real, dimension(:,:), intent(in) :: a |
| 8 |
real, dimension(:,:), intent(out), allocatable :: b |
| 9 |
b = transpose(a) |
| 10 |
end subroutine sub |
| 11 |
end module x |
| 12 |
|
| 13 |
program main |
| 14 |
use x |
| 15 |
implicit none |
| 16 |
real, dimension(2,2) :: a |
| 17 |
real, dimension(:,:), allocatable :: b |
| 18 |
data a /-2., 3., -5., 7./ |
| 19 |
call sub(a, b) |
| 20 |
if (any (b /= reshape([-2., -5., 3., 7.], shape(b)))) stop 1 |
| 21 |
b = matmul(transpose(b), a) |
| 22 |
if (any (b /= reshape([-11., 15., -25., 34.], shape(b)))) stop 2 |
| 23 |
end program |
| 24 |
|