From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id A59983857BA4; Fri, 11 Nov 2022 13:32:12 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org A59983857BA4 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1668173532; bh=GCBUsidAvZoI5B842rechb2As/LISAPW62PmnIY5PQA=; h=From:To:Subject:Date:In-Reply-To:References:From; b=uL6Z/W7L8xtEkUiA4h11ukLlGqkRrPLqPuBduTPxQx8HHI1AHX4MKd34tkMo2PMLO VVouXjo4ObNrP+amW+aXBWtG9NwZQJXRVSf44wrohNimLarbvysmTVXCq6slvk9j4d 8tehW11/tgADwr9vLk4oeCkHB4UvHZYwZ9/G398s= From: "cvs-commit at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/107618] Incorrect diagnostics when using -Og, builtin_expect(), and function attribute "warning" or "error" Date: Fri, 11 Nov 2022 13:32:12 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: tree-optimization X-Bugzilla-Version: 13.0 X-Bugzilla-Keywords: diagnostic X-Bugzilla-Severity: normal X-Bugzilla-Who: cvs-commit at gcc dot gnu.org X-Bugzilla-Status: ASSIGNED X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: rguenth at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: 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 List-Id: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D107618 --- Comment #4 from CVS Commits --- The master branch has been updated by Richard Biener : https://gcc.gnu.org/g:af96500eea72c674a5686b35c66202ef2bd9688f commit r13-3898-gaf96500eea72c674a5686b35c66202ef2bd9688f Author: Richard Biener Date: Fri Nov 11 10:12:28 2022 +0100 tree-optimization/107618 - enhance copy propagation of constants The following enhances copy propagation of constants to also see through simple operations like conversions but also operations with otherwise constant operands. That's required to fulfill the promise /* Copy propagation also copy-propagates constants, this is neces= sary to forward object-size and builtin folding results properly. = */ NEXT_PASS (pass_copy_prop); and avoid false diagnostics as shown in the testcase. We're using gimple_fold_stmt_to_constant_1 with not following SSA edges and accordingly adjust what stmts we simulate during SSA propagation. PR tree-optimization/107618 * tree-ssa-copy.cc (stmt_may_generate_copy): Simulate all assignments with a single SSA use. (copy_prop_visit_assignment): Use gimple_fold_stmt_to_constant_1 to perform simple constant folding. (copy_prop::visit_stmt): Visit all assignments. * gcc.dg/pr107618.c: New testcase.=