]> git.ipfire.org Git - thirdparty/gcc.git/commit
Fortran: Fix out of bounds access in structure constructor's clean up [PR120711]
authorAndre Vehreschild <vehre@gcc.gnu.org>
Wed, 25 Jun 2025 07:12:35 +0000 (09:12 +0200)
committerAndre Vehreschild <vehre@gcc.gnu.org>
Thu, 3 Jul 2025 11:57:38 +0000 (13:57 +0200)
commit8b7a779b85df65a29fe3820886cbd72663b6dba4
tree62c13893113133361e6dc0dd1eac4854a32c32c4
parent22b8806a627d83ccd65dd84668098c954d1f9597
Fortran: Fix out of bounds access in structure constructor's clean up [PR120711]

A structure constructor's generated clean up code was using an offset
variable, which was manipulated before the clean up was run leading to
an out of bounds access.

PR fortran/120711

gcc/fortran/ChangeLog:

* trans-array.cc (gfc_trans_array_ctor_element): Store the value
of the offset for reuse.

gcc/testsuite/ChangeLog:

* gfortran.dg/asan/array_constructor_1.f90: New test.

(cherry picked from commit dff66a690f6d47963e5cb96677d0e194b85948fa)
gcc/fortran/trans-array.cc
gcc/testsuite/gfortran.dg/asan/array_constructor_1.f90 [new file with mode: 0644]