diff options
author | Mikael Morin <mikael@gcc.gnu.org> | 2022-04-22 22:52:12 +0200 |
---|---|---|
committer | Mikael Morin <mikael@gcc.gnu.org> | 2022-04-22 22:52:12 +0200 |
commit | 89ca0fffa48b799b228beee48a16e26e24d8e199 (patch) | |
tree | c547a63bd0c2baff3cf739f247db16506e1745ca /libphobos/libdruntime | |
parent | 4938888ae1a1680e2aebf394d8fe80faad745bc7 (diff) | |
download | gcc-89ca0fffa48b799b228beee48a16e26e24d8e199.zip gcc-89ca0fffa48b799b228beee48a16e26e24d8e199.tar.gz gcc-89ca0fffa48b799b228beee48a16e26e24d8e199.tar.bz2 |
fortran: Pre-evaluate string pointers. [PR102043]
This avoids a regression on deferred_character_23.f90 later in the
patch series when array references are rewritten to use pointer
arithmetic.
The problem is a SAVE_EXPR tree as TYPE_SIZE_UNIT of one array element
type, which is used by the pointer arithmetic expressions. As these
expressions appear in both branches of an if-then-else block, the tree
is lowered to a variable in one of the branches but it’s used in both
branches, which is invalid middle-end code.
This change pre-evaluates the array references or pointer arithmetics
to variables before the if-then-else block, so that the SAVE_EXPR are
expanded to variables in the parent scope of the if-then-else block,
and expressions referencing the variables remain valid in both
branches.
PR fortran/102043
gcc/fortran/ChangeLog:
* trans-expr.cc: Pre-evaluate src and dest to variables
before using them.
gcc/testsuite/ChangeLog:
* gfortran.dg/dependency_49.f90: Update variable occurence
count.
Diffstat (limited to 'libphobos/libdruntime')
0 files changed, 0 insertions, 0 deletions