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

--- Comment #9 from Jason Merrill <jason at gcc dot gnu.org> ---
(In reply to Jakub Jelinek from comment #5)
> in main it doesn't, as the nop is stripped and the COMPONENT_REF is
> TREE_READONLY and !TREE_SIDE_EFFECTS.
> tree.cc (save_expr) documents that:
>    Constants, and certain read-only nodes, are returned with no
>    SAVE_EXPR because that is safe.

Yeah, assuming that TREE_READONLY (t) && !TREE_SIDE_EFFECTS (t) is enough to
assume that T won't change seems bogus to me.

We could remove that line from tree_invariant_p_1, or restrict it to only apply
if DECL_P (t) is also true?

Reply via email to