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

kargls at comcast dot net changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |kargls at comcast dot net

--- Comment #3 from kargls at comcast dot net ---
(In reply to Jean Vézina from comment #0)
> Created attachment 62161 [details]
> Sample program to reproduce the problem
> 
> Assignment of a value of intrinsic type (real, integer, etc) to an unlimited
> polymorphic variable is not done correctly because a segmentation fault
> occurs when a reference to the variable is made after.

It is sometimes correctly assigned. :-)

It seems that there may be an issue involving the resolution of an
unlimited polymorphic component when a left part-ref is an array.

% cat tr.F90
program foo

   type general
      class(*), allocatable :: x
   end type

#ifdef WORKS
   type(general) a
   a%x = 1
   call prn(a%x)
#else
   type(general) a(1)
   a(1)%x = 1
   call prn(a(1)%x)
#endif

   contains

      subroutine prn(x)
         class(*), intent(in) :: x
         select type(x)
         type is(integer)
            stop 1
         type is(real)
            stop 2
         end select
      end subroutine

end program foo

% gfcx -o z tr.F90 -DWORKS && ./z
STOP 1
% gfcx -o z tr.F90 && ./z
Segmentation fault (core dumped)

Reply via email to