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

--- Comment #6 from anlauf at gcc dot gnu.org ---
(In reply to Steve Kargl from comment #5)
> I'm wondering if we need to worry about other actual
> arguments.  I note
> 
> subroutine test_adjustl(x)
>   character(*) :: x(100)
>    x = adjustl(x)
>   call bar(x)
> end subroutine
> 
> does not cause problems.

Playing around with variants, the common cause of the ICE seems:

1) assumed-length character dummy with rank > 0

e.g. these declarations fail too:

  character(*) :: x(*)
  character(*), allocatable :: x(:)

but not:

  character(:), allocatable :: x(:)

2) any reference that is not a substring

e.g.

  call bar(adjustl(x))
  call bar(adjustl(x(1:1)))
  call bar(adjustl(x(:)))
  call bar(adjustl(x(:)(:)))

but not

  call bar(adjustl(x(:)(1:len(x)))) ! <- this is OK

Quite obviously the attached patch is only a band-aid to prevent the
infinite recursion, not a real solution...

Reply via email to