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

            Bug ID: 86626
           Summary: ICE
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
          Assignee: unassigned at gcc dot gnu.org
          Reporter: vivekrao4 at yahoo dot com
  Target Milestone: ---

For the code

module xyz
implicit none
interface repeat
   module procedure bar
end interface repeat
contains
pure function foo(xx) result(tf)
logical, intent(in), optional :: xx
logical                       :: tf
if (present(xx)) then
   tf = .not. xx
else
   tf = .false.
end if
end function foo
!
function bar(n,xx,alternate) result(yy)
integer          , intent(in) :: n
character (len=*), intent(in) :: xx(:)
logical          , intent(in), optional :: alternate
character (len=len(xx))       :: yy(n*size(xx))
integer                       :: i,j
if (foo(alternate)) then
   yy = (/((xx(j),i=1,n),j=1,size(xx))/)
else
   yy = (/(xx,i=1,n)/)
end if
end function bar
!
subroutine abc(labels)
character (len=*), intent(in) :: labels(:)
end subroutine abc
!
elemental function tappend(xx,yy) result(xy)
character (len=*), intent(in) :: xx,yy
character (len=len(xx) + len(yy)) :: xy
xy = trim(xx) // yy
end function tappend
end module xyz
!
program main
use xyz
implicit none
call abc(labels=tappend(["a"],"_"//repeat(1,["a"])))
end program main

compiling gfortran -c xbase_system_bug.f90 using GNU Fortran (GCC) 9.0.0
20180715 (experimental) from equation.com on Windows 10 gives

xbase_system_bug.f90:44:0:

 call abc(labels=tappend(["a"],"_"//repeat(1,["a"])))

internal compiler error: Segmentation fault

and gfortran 4.8.4 on Windows sub-system for Linux gives the same result.

Reply via email to