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

            Bug ID: 106331
           Summary: Whole array assignment of empty string segfaults with
                    -Og
           Product: gcc
           Version: 12.1.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
          Assignee: unassigned at gcc dot gnu.org
          Reporter: stuart_mentzer at objexx dot com
  Target Milestone: ---

Whole array assignment of the empty string to a character array segfaults if
built with -Og.

PROGRAM main
CHARACTER(LEN=24) :: a(2)
a = ''
END PROGRAM

These variations run OK:
- Not built with -Og
- Assignment is to scalar instead of array
- Assignment is a space character
- Assignment to element of the array


This is a regression I am seeing in 12.1.0 but did not get with 11.3.0.

Tested on MinGW (Windows 10) and Manjaro with GFortran 12.1.0.

The error message I get on Windows is:
Program received signal SIGSEGV: Segmentation fault - invalid memory reference.

Reply via email to