]> git.ipfire.org Git - thirdparty/gcc.git/commit
Fortran: Fix missing substring ref for allocatable saved vars [PR120483]
authorAndre Vehreschild <vehre@gcc.gnu.org>
Mon, 2 Jun 2025 08:41:48 +0000 (10:41 +0200)
committerAndre Vehreschild <vehre@gcc.gnu.org>
Fri, 13 Jun 2025 05:55:58 +0000 (07:55 +0200)
commit1549bb90c10c5e3ef1c5f2080cdb58dbaee25291
treeaf394b2b454df64e8d4c8fcbe1e0e1232256f8ad
parent88ec0fedaf698aeafe84710a6bada738203bca5b
Fortran: Fix missing substring ref for allocatable saved vars [PR120483]

Compute a substring ref on an allocatable static character array
using pointer arithmetic.  Using an array type corrupts type
layouting and crashes omp generation.

PR fortran/120483

gcc/fortran/ChangeLog:

* trans-expr.cc (gfc_conv_substring): Use pointer arithmetic on
static allocatable char arrays.

gcc/testsuite/ChangeLog:

* gfortran.dg/save_8.f90: New test.

(cherry picked from commit 5c9bdfd2748b8159856a37404ab7b34d977242ce)
gcc/fortran/trans-expr.cc
gcc/testsuite/gfortran.dg/save_8.f90 [new file with mode: 0644]