https://gcc.gnu.org/bugzilla/show_bug.cgi?id=120400
--- Comment #12 from Iain Sandoe <iains at gcc dot gnu.org> --- (In reply to Richard Biener from comment #11) > D_V_E? DECL_VALUE_EXPR? yes.. > I guess we should indeed treat those as having > side-effects. struct F { bool b; }; int foo (F *a) { if (a && !a->b) return 6; return 42; } Works as expected - but I do not see TREE_SIDE_EFFECTS set on any part of the component ref expression. I was going to investigate "looking through" expressions with a D_V_E and applying the rules to the latter .. but not got to that yet. > But without actually setting TREE_SIDE_EFFECTS that's hard to > properly propagate everywhere, so yeah - I suggest doing that. Hmm - seems a bit of a big hammer .. but.