https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84900

--- Comment #9 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The trunk branch has been updated by Andrew Pinski <pins...@gcc.gnu.org>:

https://gcc.gnu.org/g:80ed2a6471a39dd95192a334789fd63d5efd2e8a

commit r13-6836-g80ed2a6471a39dd95192a334789fd63d5efd2e8a
Author: Andrew Pinski <apin...@marvell.com>
Date:   Thu Mar 23 02:10:11 2023 +0000

    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.

Reply via email to