Is this program conforming?
module m
implicit none
type t1
integer :: age
end type t1
type, extends( t1 ) :: t2
real :: height_cm
end type t2
type, extends( t2 ) :: t3
real :: mass_kg
end type t3
contains
subroutine s( man )
class( t1 ) :: man(:)
integer :: i
do i = 1, size( man )
if ( man(i) % age .gt. 3 ) write (*,*) man(i) % age
end do
end subroutine s
end module m
program z
use m
implicit none
type( t3 ) :: person3( 5 )
integer :: i
person3 % t2 % age = (/ (i, i=1, size(person3)) /)
write (*,*) person3 % age
write (*,*) person3 % t1 % age
write (*,*) person3 % t2 % age
call s( person3 % t1 )
call s( person3 % t2 )
call s( person3 )
end program z
I think yes.
The expected output is:
1 2 3 4 5
1 2 3 4 5
1 2 3 4 5
4
5
4
5
4
5
Compiler 1 gives this output.
Compiler 2 gives ICE.
Compiler 3 is missing the output from lines
call s( person3 % t1 )
call s( person3 % t2 )
Anton
|