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

--- Comment #1 from Walter Spector <w6ws at earthlink dot net> ---
Slightly different test case - using allocatable string length instead of the
trims.  However the same problems are evident:

program testch
  implicit none

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

contains

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

    integer :: i

    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 testch.f90
wws@w6ws-4:/tmp$ a.out
           1 >xyz/one<
           2 >xyz/thr<
           3 >xyz/fiv<
           4 >xyz/eig<
           5 >xyz/for<
*** Error in `a.out': free(): invalid next size (fast): 0x000000000217b640 ***
======= Backtrace: =========
/lib/x86_64-linux-gnu/libc.so.6(+0x777e5)[0x7fac7b49c7e5]
/lib/x86_64-linux-gnu/libc.so.6(+0x8037a)[0x7fac7b4a537a]
/lib/x86_64-linux-gnu/libc.so.6(cfree+0x4c)[0x7fac7b4a953c]
a.out[0x401280]
a.out[0x4012c5]
/lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xf0)[0x7fac7b445830]
a.out[0x400949]
======= Memory map: ========
00400000-00402000 r-xp 00000000 08:0a 40632824                          
/tmp/a.out
00601000-00602000 rw-p 00001000 08:0a 40632824                          
/tmp/a.out
02178000-02199000 rw-p 00000000 00:00 0                                  [heap]
7fac74000000-7fac74021000 rw-p 00000000 00:00 0 
7fac74021000-7fac78000000 ---p 00000000 00:00 0 
7fac7b425000-7fac7b5e5000 r-xp 00000000 08:0a 20190243                  
/lib/x86_64-linux-gnu/libc-2.23.so
7fac7b5e5000-7fac7b7e5000 ---p 001c0000 08:0a 20190243                  
/lib/x86_64-linux-gnu/libc-2.23.so
7fac7b7e5000-7fac7b7e9000 r--p 001c0000 08:0a 20190243                  
/lib/x86_64-linux-gnu/libc-2.23.so
7fac7b7e9000-7fac7b7eb000 rw-p 001c4000 08:0a 20190243                  
/lib/x86_64-linux-gnu/libc-2.23.so
7fac7b7eb000-7fac7b7ef000 rw-p 00000000 00:00 0 
7fac7b7ef000-7fac7b82e000 r-xp 00000000 08:0a 48497154                  
/usr/local/gcc-trunk/lib64/libquadmath.so.0.0.0
7fac7b82e000-7fac7ba2d000 ---p 0003f000 08:0a 48497154                  
/usr/local/gcc-trunk/lib64/libquadmath.so.0.0.0
7fac7ba2d000-7fac7ba2e000 rw-p 0003e000 08:0a 48497154                  
/usr/local/gcc-trunk/lib64/libquadmath.so.0.0.0
7fac7ba2e000-7fac7ba45000 r-xp 00000000 08:0a 48497146                  
/usr/local/gcc-trunk/lib64/libgcc_s.so.1
7fac7ba45000-7fac7bc44000 ---p 00017000 08:0a 48497146                  
/usr/local/gcc-trunk/lib64/libgcc_s.so.1
7fac7bc44000-7fac7bc45000 rw-p 00016000 08:0a 48497146                  
/usr/local/gcc-trunk/lib64/libgcc_s.so.1
7fac7bc45000-7fac7bd4d000 r-xp 00000000 08:0a 20185261                  
/lib/x86_64-linux-gnu/libm-2.23.so
7fac7bd4d000-7fac7bf4c000 ---p 00108000 08:0a 20185261                  
/lib/x86_64-linux-gnu/libm-2.23.so
7fac7bf4c000-7fac7bf4d000 r--p 00107000 08:0a 20185261                  
/lib/x86_64-linux-gnu/libm-2.23.so
7fac7bf4d000-7fac7bf4e000 rw-p 00108000 08:0a 20185261                  
/lib/x86_64-linux-gnu/libm-2.23.so
7fac7bf4e000-7fac7c1b8000 r-xp 00000000 08:0a 48497159                  
/usr/local/gcc-trunk/lib64/libgfortran.so.5.0.0
7fac7c1b8000-7fac7c3b8000 ---p 0026a000 08:0a 48497159                  
/usr/local/gcc-trunk/lib64/libgfortran.so.5.0.0
7fac7c3b8000-7fac7c3ba000 rw-p 0026a000 08:0a 48497159                  
/usr/local/gcc-trunk/lib64/libgfortran.so.5.0.0
7fac7c3ba000-7fac7c3bb000 rw-p 00000000 00:00 0 
7fac7c3bb000-7fac7c3e1000 r-xp 00000000 08:0a 20190239                  
/lib/x86_64-linux-gnu/ld-2.23.so
7fac7c5b9000-7fac7c5bd000 rw-p 00000000 00:00 0 
7fac7c5de000-7fac7c5e0000 rw-p 00000000 00:00 0 
7fac7c5e0000-7fac7c5e1000 r--p 00025000 08:0a 20190239                  
/lib/x86_64-linux-gnu/ld-2.23.so
7fac7c5e1000-7fac7c5e2000 rw-p 00026000 08:0a 20190239                  
/lib/x86_64-linux-gnu/ld-2.23.so
7fac7c5e2000-7fac7c5e3000 rw-p 00000000 00:00 0 
7ffd9dc1f000-7ffd9dc40000 rw-p 00000000 00:00 0                         
[stack]
7ffd9dd24000-7ffd9dd27000 r--p 00000000 00:00 0                          [vvar]
7ffd9dd27000-7ffd9dd29000 r-xp 00000000 00:00 0                          [vdso]
ffffffffff600000-ffffffffff601000 r-xp 00000000 00:00 0                 
[vsyscall]

Program received signal SIGABRT: Process abort signal.

Backtrace for this error:
#0  0x7fac7b45a4af in ???
#1  0x7fac7b45a428 in ???
#2  0x7fac7b45c029 in ???
#3  0x7fac7b49c7e9 in ???
#4  0x7fac7b4a5379 in ???
#5  0x7fac7b4a953b in ???
#6  0x40127f in testch
        at /tmp/testch.f90:11
#7  0x4012c4 in main
        at /tmp/testch.f90:11
Aborted (core dumped)
wws@w6ws-4:/tmp$

Reply via email to