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

--- Comment #1 from Gerhard Steinmetz <gerhard.steinmetz.fort...@t-online.de> 
---
Similar :


$ cat z7.f90
program p
   integer :: i
   character(3), parameter :: x(3) = ['abc', 'ijk', 'xyz']
   character(3), parameter :: y(2) = [(x(i)(i:1), i=2,3)]
end

$ gfortran-6 z7.f90
*** Error in `/usr/lib64/gcc/x86_64-suse-linux/6/f951': malloc(): memory
corruption: 0x0000000003081750 ***



$ cat z8.f90
program p
   integer :: i
   character(3), parameter :: x(3) = ['abc', 'ijk', 'xyz']
   character(3) :: y(2) = [(x(i)(i:1), i=2,3)]
end

$ gfortran-6 z8.f90
*** Error in `/usr/lib64/gcc/x86_64-suse-linux/6/f951': malloc(): memory
corruption: 0x00000000025d6730 ***



$ cat z9.f90
program p
   integer :: i
   character(3), parameter :: x(3) = ['abc', 'ijk', 'xyz']
   character(3) :: y(2)
   y = [(x(i)(i:1), i=2,3)]
end

$ gfortran-6 z9.f90
*** Error in `/usr/lib64/gcc/x86_64-suse-linux/6/f951': malloc(): memory
corruption: 0x0000000002b57900 ***



Compiles and runs :

$ cat za.f90
program p
   integer :: i
   character(3) :: x(3)
   character(3) :: y(2)
   x = ['abc', 'ijk', 'xyz']
   y = [(x(i)(i:1), i=2,3)]
   print *, len_trim(x), x
   print *, len_trim(y)
end

$ gfortran-6 za.f90
$ a.out
           3           3           3 abcijkxyz
           0           0

Reply via email to