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

--- Comment #3 from Paul Thomas <pault at gcc dot gnu.org> ---
(In reply to Paul Thomas from comment #2)
> Created attachment 46375 [details]
> Patch for the problem
> 
> I very much doubt that this was revision r257065. The problem looks to have
> Andre's signature on it. Nevertheless, I have the fix attached and have
> taken it.
> 
>   type field_names_a
>     class(*), pointer :: var(:) =>null()
>   end type
> 
>   type(field_names_a),pointer :: a(:)
>   allocate (a(1))
> 
>   allocate (a(1)%var(2), source = ["hello"," baby"])
>   call s(a)
>   deallocate (a(1)%var)
>   deallocate (a)
> contains
>   subroutine s(a)
> 
>     type(field_names_a) :: a(:)
> 
>     select type (var => a(1)%var)
>       type is (character(*))
>         print *, var
>       class default
>         stop
>     end select
>     associate (var => a(i)%var)
>       select type (var2 => a(1)%var)
>         type is (character(*))
>           print *, var2
>         class default
>           stop
>       end select
>     end associate
>   end
> end
> 
> Does the right thing mostly but sometimes, after recompilation, segfaults at
> runtime - I will check out why before submitting.
> 
> Paul

The segfaults were a fingers problem on my part - 'i' instead of '1' in the
subscript.

Have submitted to the list with the testcase.
Paul

Reply via email to