From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id E76983858D32; Tue, 26 Jul 2022 14:09:48 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org E76983858D32 From: "mpolacek at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug middle-end/102633] [11/12/13 Regression] warning for self-initialization despite -Wno-init-self Date: Tue, 26 Jul 2022 14:09:48 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: middle-end X-Bugzilla-Version: 12.0 X-Bugzilla-Keywords: diagnostic X-Bugzilla-Severity: normal X-Bugzilla-Who: mpolacek at gcc dot gnu.org X-Bugzilla-Status: NEW X-Bugzilla-Resolution: X-Bugzilla-Priority: P2 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: 11.4 X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: cc Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-BeenThere: gcc-bugs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-bugs mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 26 Jul 2022 14:09:49 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D102633 Marek Polacek changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |mpolacek at gcc dot gnu.org --- Comment #5 from Marek Polacek --- 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)) !=3D ARRAY_TYPE)) 2174 exp.value =3D 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 =3D x; as it is a GCC extension to tur= n 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)) =3D=3D 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.=