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

--- Comment #5 from patnel97269-gfortran at yahoo dot fr ---
(In reply to janus from comment #3)
> Actually one can reduce it even further:
> 
> 
> program main
> 
>   type :: my_integer
>     real, allocatable :: x(:)
>   end type
>   type(my_integer) :: a
> 
>   a=my_integer([1])
>   write (*,*) "A"
>   call ass(a)
>   write (*,*) "B"
>   call ass((a))
>   write (*,*) "C"
> 
> contains
> 
>   subroutine ass(b)
>     class(my_integer), intent(in) :: b
>     print *,'called ass'
>   end subroutine
> 
> end
> 
> 
> This program does not do anything useful any more, but it still shows the
> same segfault at/after the call to "ass((a))":
> 
> $ ./a.out 
>  A
>  called ass
>  B
>  called ass
> 
> Program received signal SIGSEGV: Segmentation fault - invalid memory
> reference.
> 
> 
> Making 'b' a TYPE instead of a CLASS makes the error go away.



I agree that this example still trigger a bug, but I remember in my original
(more complicated) code, the segfault appears when it tries to access the
allocatable components of the type in the subroutine before computation and
before returning. So the problem might be at entrance and not necessarily after
the call. This need to be confirmed.

Reply via email to