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

--- Comment #2 from Walter Spector <w6ws at earthlink dot net> ---
Third variant.  This one messes up NAG and PGI too:

wws@w6ws-4:/tmp$ cat testch3.f90
program testch
  implicit none

  character(:), allocatable :: path(:)
  path = 'xyz/'
  path = (/ character(16) :: &
      path // "one",  &
      path // "three",  &
      path // "five",  &
      path // "eight",  &
      path // "forty two" /)
  call print_strings (path)

contains

  subroutine print_strings (s)
    character(*), intent(in) :: s(:)

    integer :: i

    print *, 'character string length:', len (s)
    print *, 'array size =', size (s)

    do, i=1, size(s)
      print *, i, '>', s(i), '<'
    end do

  end subroutine
end program
wws@w6ws-4:/tmp$ /usr/local/gcc-trunk/bin/gfortran -g testch3.f90
wws@w6ws-4:/tmp$ a.out

Program received signal SIGSEGV: Segmentation fault - invalid memory reference.

Backtrace for this error:
#0  0x7fe073c854af in ???
#1  0x400ea3 in testch
        at /tmp/testch3.f90:5
#2  0x401b66 in main
        at /tmp/testch3.f90:12
Segmentation fault (core dumped)
wws@w6ws-4:/tmp$

Reply via email to