The master branch has been updated by Jerry DeLisle <[email protected]>:
https://gcc.gnu.org/g:4d75e994d6817b84c3236e4e56622fe3bea4af04
commit r17-5068-g4d75e994d6817b84c3236e4e56622fe3bea4af04
Author: Jerry DeLisle <[email protected]>
Date: Thu Jun 11 18:17:46 2026 -0700
fortran: [PR125762] Fix segfault for DATA pointer init to an array element
Many thanks,
Jerry
On 10/11/26 2:29 AM, Mikael Morin wrote:
Le 10/10/2026 à 21:57, Jerry DeLisle a écrit :
See attached patch. A DATA statement that initializes a pointer to an
array element, e.g. data p /t(3)/, segfaults in
gfc_conv_scalarized_array_ref. resolve_data resolves the variables of
a DATA statement but not its values, so t(3) is still an AR_UNKNOWN
reference when it reaches code generation, where it takes the
scalarized path with no scalarizer. The patch calls gfc_resolve_expr
on each value in resolve_data before the values are matched to the
variables.
The fix is in resolve_data in resolve.cc; the rest is the new test. The
bug was found with the Fujitsu compiler test suite; the test is new.
Regression tested on x86_64.
OK for mainline?
Regards,
Jerry
---
fortran: [PR125762] Fix segfault for DATA pointer init to an array element
Resolve the value expressions of a DATA statement in resolve_data.
Assisted-by: Claude Opus 5.5
PR fortran/125762
gcc/fortran/ChangeLog:
* resolve.cc (resolve_data): Call gfc_resolve_expr on each value
expression.
gcc/testsuite/ChangeLog:
* gfortran.dg/data_pointer_4.f90: New test.
OK.