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

anlauf at gcc dot gnu.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|Whole array assignment of   |[12/13 Regression] Whole
                   |empty string segfaults with |array assignment of empty
                   |-Og                         |string segfaults with -Og
   Last reconfirmed|                            |2022-07-17
                 CC|                            |anlauf at gcc dot gnu.org
             Status|UNCONFIRMED                 |NEW
     Ever confirmed|0                           |1
   Target Milestone|---                         |12.2
      Known to work|                            |11.3.1
      Known to fail|                            |12.1.1

--- Comment #1 from anlauf at gcc dot gnu.org ---
Confirmed on x86_64-pc-linux-gnu with -m64 for character length 17 to 31.
For -m32 the issue does not show up, at least for the character length values
I tried.

Note however that replacing the array assignment

  a = ''

by an explicit loop

  do i = 1,2
     a(i) = ''
  end do

does not change the behavior of the reproducer.

valgrind a.out says:

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

Backtrace for this error:
#0  0x5b0fd6f in ???
#1  0x4005e7 in ???
#2  0x40061f in ???
#3  0x5afa2bc in ???
#4  0x400519 in ???
#5  0xffffffffffffffff in ???
==14463== 
==14463== Process terminating with default action of signal 11 (SIGSEGV):
dumping core
==14463==    at 0x5B0FCB9: raise (in /lib64/libc-2.31.so)
==14463==    by 0x5B0FD6F: ??? (in /lib64/libc-2.31.so)
==14463==    by 0x4005E6: MAIN__ (in /home/anlauf/gcc-bugs/a.out)
==14463==    by 0x40061F: main (in /home/anlauf/gcc-bugs/a.out)

I have no idea what is going on here...

Reply via email to