| 1 |
! { dg-do run } |
| 2 |
! |
| 3 |
! Test the fix for PR96726 |
| 4 |
! |
| 5 |
|
| 6 |
module cref_m |
| 7 |
|
| 8 |
implicit none |
| 9 |
|
| 10 |
private |
| 11 |
|
| 12 |
public :: & |
| 13 |
sizeish |
| 14 |
|
| 15 |
contains |
| 16 |
|
| 17 |
pure function sizeish(a) result(s) |
| 18 |
integer, intent(in) :: a(..) |
| 19 |
|
| 20 |
integer :: s |
| 21 |
|
| 22 |
s = size(a) |
| 23 |
return |
| 24 |
end function sizeish |
| 25 |
|
| 26 |
end module cref_m |
| 27 |
|
| 28 |
program cref_p |
| 29 |
|
| 30 |
use cref_m, only: & |
| 31 |
sizeish |
| 32 |
|
| 33 |
implicit none |
| 34 |
|
| 35 |
integer :: i |
| 36 |
|
| 37 |
integer, parameter :: n = 3 |
| 38 |
integer, parameter :: p(*) = [(i, i=1,n*n)] |
| 39 |
|
| 40 |
integer :: a(n,n) |
| 41 |
integer :: b(n*n) |
| 42 |
|
| 43 |
a = reshape(p, shape=[n,n]) |
| 44 |
call isub_a(a, b) |
| 45 |
if (any(b/=p)) stop 1 |
| 46 |
call isub_b(a, b) |
| 47 |
if (any(b/=p)) stop 2 |
| 48 |
stop |
| 49 |
|
| 50 |
contains |
| 51 |
|
| 52 |
subroutine isub_a(a, b) |
| 53 |
integer, intent(in) :: a(..) |
| 54 |
integer, intent(out) :: b(size(a)) |
| 55 |
|
| 56 |
integer :: i |
| 57 |
|
| 58 |
b = [(i, i=1,size(b))] |
| 59 |
return |
| 60 |
end subroutine isub_a |
| 61 |
|
| 62 |
subroutine isub_b(a, b) |
| 63 |
integer, intent(in) :: a(..) |
| 64 |
integer, intent(out) :: b(sizeish(a)) |
| 65 |
|
| 66 |
integer :: i |
| 67 |
|
| 68 |
b = [(i, i=1,sizeish(b))] |
| 69 |
return |
| 70 |
end subroutine isub_b |
| 71 |
|
| 72 |
end program cref_p |