diff options
author | Mikael Morin <mikael@gcc.gnu.org> | 2025-07-27 17:11:50 +0200 |
---|---|---|
committer | Mikael Morin <mikael@gcc.gnu.org> | 2025-07-27 17:25:51 +0200 |
commit | 1800ac20f66812c72b144848f7ec8e66156f06f8 (patch) | |
tree | 8ef9e6083361ab7988d53423a9e0cadf0bbde393 /gcc/diagnostics/changes.cc | |
parent | 5f9f20df98b1fe8dd8b179b157d268470bde70f4 (diff) | |
download | gcc-1800ac20f66812c72b144848f7ec8e66156f06f8.zip gcc-1800ac20f66812c72b144848f7ec8e66156f06f8.tar.gz gcc-1800ac20f66812c72b144848f7ec8e66156f06f8.tar.bz2 |
fortran: Trigger reference saving on pointer dereference [PR121185]
This is a follow-up to revision:
r16-2371-g8f41c87654fd819e48c9f6f1ac3d87e35794d310
fortran: Factor array descriptor references
That revision introduced new variables to limit repeated subexpressions
in array descriptor references. The change added a walk along the
reference from child to parent, that selected subreferences worth
saving and applied the saving if the reference proved non-trivial
enough. Trivialness was defined in a comment as: only made of a DECL
and NOPs and COMPONENTs. But the case of a pointer derefence didn't
trigger the saving, so the code was also considering a dereference as if
it was trivial.
This change triggers the reference saving on pointer dereferences,
making the trivialness as defined by the code aligned with the comment.
This change is not strictly speaking a bug fix, but PR #121185 exhibited
wrong code examples where the lack of a variable hiding the polymorphic
leading part of a non-polymorphic array reference was causing the latter
to be evaluated in a polymorphic way.
PR fortran/121185
gcc/fortran/ChangeLog:
* trans-array.cc (set_factored_descriptor_value): Also trigger
the saving of the previously selected reference on encountering
an INDIRECT_REF. Extract the saving code...
(save_ref): ... here as a new function.
gcc/testsuite/ChangeLog:
* gfortran.dg/assign_14.f90: New test.
Diffstat (limited to 'gcc/diagnostics/changes.cc')
0 files changed, 0 insertions, 0 deletions