https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81748

            Bug ID: 81748
           Summary: extensible types non-conforming behaviour
           Product: gcc
           Version: 8.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
          Assignee: unassigned at gcc dot gnu.org
          Reporter: mexas at bristol dot ac.uk
  Target Milestone: ---

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

The correct output is (e.g. ifort 16 gives it):

           1           2           3           4           5
           1           2           3           4           5
           1           2           3           4           5
           4
           5
           4
           5
           4
           5

However, with gfortran8 the output is missing from lines:
   call s( person3 % t1 )
   call s( person3 % t2 )

Reply via email to