diff options
author | Andrew Pinski <apinski@marvell.com> | 2023-03-23 02:10:11 +0000 |
---|---|---|
committer | Andrew Pinski <apinski@marvell.com> | 2023-03-23 17:24:59 +0000 |
commit | 80ed2a6471a39dd95192a334789fd63d5efd2e8a (patch) | |
tree | 2681dc02319228dd54f6f5bdec4655fae109d255 /gcc/fortran | |
parent | 5ededfa5b23781c3be6fcf6bb373418aa8bd6541 (diff) | |
download | gcc-80ed2a6471a39dd95192a334789fd63d5efd2e8a.zip gcc-80ed2a6471a39dd95192a334789fd63d5efd2e8a.tar.gz gcc-80ed2a6471a39dd95192a334789fd63d5efd2e8a.tar.bz2 |
c: [PR84900] cast of compound literal does not cause the code to become a non-lvalue
The problem here is after r0-92187-g2ec5deb5c3146c, maybe_lvalue_p would
return false for compound literals which causes non_lvalue_loc not
to wrap the expression with a NON_LVALUE_EXPR unlike before when it
return true as it returns true for all language specific tree codes.
This fixes that oversight and fixes the testcase to have the cast as
a non-lvalue.
Committed to the trunk as obvious after a bootstrap/test on x86_64-linux-gnu.
PR c/84900
gcc/ChangeLog:
* fold-const.cc (maybe_lvalue_p): Treat COMPOUND_LITERAL_EXPR
as a lvalue.
gcc/testsuite/ChangeLog:
* gcc.dg/compound-literal-cast-lvalue-1.c: New test.
Diffstat (limited to 'gcc/fortran')
0 files changed, 0 insertions, 0 deletions