| 1 |
! { dg-do run } |
| 2 |
! { dg-additional-options "-fno-f2c" } |
| 3 |
! |
| 4 |
! PR fortran/104312 - ICE in fold_convert_loc with entry, -ff2c: control |
| 5 |
! Contributed by G.Steinmetz |
| 6 |
|
| 7 |
module m |
| 8 |
implicit none |
| 9 |
contains |
| 10 |
function f() |
| 11 |
real, pointer :: f, e |
| 12 |
real, target :: a(2) = [1,2] |
| 13 |
f => a(1) |
| 14 |
return |
| 15 |
entry e() |
| 16 |
e => a(2) |
| 17 |
end |
| 18 |
function g() |
| 19 |
complex, pointer :: g,h |
| 20 |
complex, target :: a(2) = [3,4] |
| 21 |
g => a(1) |
| 22 |
return |
| 23 |
entry h() |
| 24 |
h => a(2) |
| 25 |
end |
| 26 |
function f3() |
| 27 |
real, allocatable :: f3, e3 |
| 28 |
allocate (f3, source=1.0) |
| 29 |
return |
| 30 |
entry e3() |
| 31 |
allocate (e3, source=2.0) |
| 32 |
end |
| 33 |
function g3() |
| 34 |
complex, allocatable :: g3, h3 |
| 35 |
allocate (g3, source=(3.0,0.0)) |
| 36 |
return |
| 37 |
entry h3() |
| 38 |
allocate (h3, source=(4.0,0.0)) |
| 39 |
end |
| 40 |
end |
| 41 |
|
| 42 |
program p |
| 43 |
use m |
| 44 |
real, pointer :: x |
| 45 |
complex, pointer :: c |
| 46 |
real :: y |
| 47 |
complex :: d |
| 48 |
x => f() |
| 49 |
if (x /= 1.0) stop 1 |
| 50 |
x => e() |
| 51 |
if (x /= 2.0) stop 2 |
| 52 |
c => g() |
| 53 |
if (c /= (3.0,0.0)) stop 3 |
| 54 |
c => h() |
| 55 |
if (c /= (4.0,0.0)) stop 4 |
| 56 |
y = f3() |
| 57 |
if (y /= 1.0) stop 5 |
| 58 |
y = e3() |
| 59 |
if (y /= 2.0) stop 6 |
| 60 |
d = g3() |
| 61 |
if (d /= (3.0,0.0)) stop 7 |
| 62 |
d = h3() |
| 63 |
if (d /= (4.0,0.0)) stop 8 |
| 64 |
end |