https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78373
Jakub Jelinek <jakub at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |jakub at gcc dot gnu.org --- Comment #2 from Jakub Jelinek <jakub at gcc dot gnu.org> --- So, what happens is that we have: &self->D.2295 and on that ADDR_EXPR we have TREE_CONSTANT set, because the field offset is constant, and the base is INDIRECT_REF/MEM_REF with the self VAR_DECL as operand, and that VAR_DECL has TREE_CONSTANT set. But later on we rewrite it into SSA form and it becomes &self_2->D.2295 instead, and the MEM_REF operand in that case is SSA_NAME. And that SSA_NAME self_2 doesn't have TREE_CONSTANT set on it. So the questions are: 1) is it ok to have the TREE_CONSTANT on such VAR_DECLs (in the FEs, and/or in the middle-end; e.g. if it is ok to have it in the FEs and not in ME, we need to clear it somewhere and recompute the ADDR invariant stuff) 2) shall SSA_NAME for TREE_CONSTANT VAR_DECL have TREE_CONSTANT flag set or not? 3) shall recompute_tree_invariant_for_addr_expr look through SSA_NAMEs to their SSA_NAME_VAR if non-NULL for flags updating?