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

neil.n.carlson at gmail dot com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |neil.n.carlson at gmail dot com

--- Comment #19 from neil.n.carlson at gmail dot com ---
What is the status of this issue?  It would appear from comment 18 to be
"fixed" insofar as the the provided examples compile, but is the compiled code
correct?

I'd report the following example as a new bug, but I know it would be
immediately dismissed as a duplicate of this bug.  This dumb little example
compiles with 5.2 and the 20151025 snapshot of 6.0, but in both cases the
generated code is bad as it segfaults on a clearly valid assignment statement.

program main
  character(:), allocatable :: string(:)
  call fubar (string)
contains
  subroutine fubar (string)
    character(:), allocatable, intent(out) :: string(:)
    allocate(character(5) :: string(2))
    print *, 'len(string)=', len(string), ', size(string)=', size(string)
    string = 'fubar' ! <== SEGMENTATION FAULT HERE
  end subroutine
end program

Produces this output:

 len(string)=           5 , size(string)=           2

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

Backtrace for this error:
#0  0x7FFB05C4E517
#1  0x7FFB05C4EB5E
#2  0x7FFB0514F95F
#3  0x7FFB051B6EC8
#4  0x400D23 in fubar.3417 at fubar.f90:?
#5  0x400DC9 in MAIN__ at fubar.f90:?
Segmentation fault (core dumped)

Reply via email to