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

anlauf at gcc dot gnu.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2025-05-09
                 CC|                            |anlauf at gcc dot gnu.org
           Keywords|                            |wrong-code
     Ever confirmed|0                           |1

--- Comment #1 from anlauf at gcc dot gnu.org ---
Confirmed.

Here's a testcase that fails under valgrind:

program p
  implicit none
  character(:), allocatable :: a(:), s
  allocate (character(16) :: a(10), s)
  a(:)(:) = ""
  s(:)    = "*"
  print *, findloc (a, s, dim=1, back=.true.)
  deallocate (a, s)
end program p


==25050== Invalid read of size 8
==25050==    at 0x484D769: bcmp (in
/usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==25050==    by 0x4174BA: _gfortran_compare_string (string_intrinsics_inc.c:98)
==25050==    by 0x4043B2: _gfortran_findloc2_s1 (findloc2_s1.c:54)
==25050==    by 0x402C16: MAIN__ (in /home/anlauf/gcc-bugs/a.out)
==25050==    by 0x402D03: main (in /home/anlauf/gcc-bugs/a.out)
==25050==  Address 0x4bae9d0 is 16 bytes before a block of size 160 alloc'd
==25050==    at 0x4841744: malloc (in
/usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==25050==    by 0x4029C1: MAIN__ (in /home/anlauf/gcc-bugs/a.out)
==25050==    by 0x402D03: main (in /home/anlauf/gcc-bugs/a.out)
==25050== 
==25050== Invalid read of size 1
==25050==    at 0x484D7B7: bcmp (in
/usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==25050==    by 0x4174BA: _gfortran_compare_string (string_intrinsics_inc.c:98)
==25050==    by 0x4043B2: _gfortran_findloc2_s1 (findloc2_s1.c:54)
==25050==    by 0x402C16: MAIN__ (in /home/anlauf/gcc-bugs/a.out)
==25050==    by 0x402D03: main (in /home/anlauf/gcc-bugs/a.out)
==25050==  Address 0x4bae9d0 is 16 bytes before a block of size 160 alloc'd
==25050==    at 0x4841744: malloc (in
/usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==25050==    by 0x4029C1: MAIN__ (in /home/anlauf/gcc-bugs/a.out)
==25050==    by 0x402D03: main (in /home/anlauf/gcc-bugs/a.out)

Reply via email to