https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102633
Marek Polacek <mpolacek at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |mpolacek at gcc dot gnu.org --- Comment #5 from Marek Polacek <mpolacek at gcc dot gnu.org> --- The problem is that since the patch above, we create a NOP_EXPR: 2172 if (convert_p && !error_operand_p (exp.value) 2173 && (TREE_CODE (TREE_TYPE (exp.value)) != ARRAY_TYPE)) 2174 exp.value = convert (build_qualified_type (TREE_TYPE (exp.value), TYPE_UNQUALIFIED), exp.value); so the DECL_INITIAL is '(int) i' and not 'i' anymore. Then we don't suppress_warning here: 711 case DECL_EXPR: 712 /* This is handled mostly by gimplify.cc, but we have to deal with 713 not warning about int x = x; as it is a GCC extension to turn off 714 this warning but only if warn_init_self is zero. */ 715 if (VAR_P (DECL_EXPR_DECL (*expr_p)) 716 && !DECL_EXTERNAL (DECL_EXPR_DECL (*expr_p)) 717 && !TREE_STATIC (DECL_EXPR_DECL (*expr_p)) 718 && (DECL_INITIAL (DECL_EXPR_DECL (*expr_p)) == DECL_EXPR_DECL (*expr_p)) 719 && !warn_init_self) 720 suppress_warning (DECL_EXPR_DECL (*expr_p), OPT_Winit_self); because of the check on line 718.