nncarlson / gfortran.dg

The GFortran testsuite rigged for testing other Fortran compilers
7 stars 2 forks source link

Invalid code in pdt_22.f90 #19

Open nncarlson opened 6 years ago

nncarlson commented 6 years ago

The pdt_22.f90 test

program p
   character(120) :: buffer
   integer :: i(4)
   type t(a)
      integer, len :: a
   end type
   type t2(b)
      integer, len :: b
      type(t(1)) :: r(b)
   end type
   type(t2(3)) :: x
   write (buffer,*) x
   read (buffer,*) i
   if (any (i .ne. [3,1,1,1])) stop 1
end

presumes the WRITE will output the value of the type parameter B followed by the values of the component array R(B), judging from the subsequent READ and IF test. But this is not correct; intrinsic output of a PDT does not include type parameters. See PR84143