From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id CE57F385842F; Mon, 8 Nov 2021 15:42:25 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org CE57F385842F From: "msebor at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug bootstrap/102831] [12 regression] Spurious -Wparentheses etc. warnings Date: Mon, 08 Nov 2021 15:42:25 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: bootstrap X-Bugzilla-Version: 12.0 X-Bugzilla-Keywords: build, diagnostic, GC X-Bugzilla-Severity: normal X-Bugzilla-Who: msebor at gcc dot gnu.org X-Bugzilla-Status: NEW X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: 12.0 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 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: Mon, 08 Nov 2021 15:42:25 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D102831 --- Comment #4 from Martin Sebor --- I have been testing the following changes to deal with other location and warning related problems. They might be worth giving a try to see if they = help with this issue as well.=20 diff --git a/gcc/diagnostic-spec.c b/gcc/diagnostic-spec.c index 85ffb725c02..09fd42bcf53 100644 --- a/gcc/diagnostic-spec.c +++ b/gcc/diagnostic-spec.c @@ -186,11 +186,8 @@ copy_warning (location_t to, location_t from) /* We cannot set no-warning dispositions for 'to', so we have no chance but lose those potentially set for 'from'. */ ; - else - { - if (from_spec) - nowarn_map->put (to, *from_spec); - else - nowarn_map->remove (to); - } + else if (from_spec) + nowarn_map->put (to, *from_spec); + /* ...else keep the entry since it may be referenced by multiple trees + or GIMPLE statements at this location. */ } diff --git a/gcc/warning-control.cc b/gcc/warning-control.cc index 36a47ab6bae..e490bf28b24 100644 --- a/gcc/warning-control.cc +++ b/gcc/warning-control.cc @@ -198,21 +198,13 @@ void copy_warning (ToType to, FromType from) /* We cannot set no-warning dispositions for 'to', so we have no chance but lose those potentially set for 'from'. */ ; - else + else if (from_spec) { - if (from_spec) - { - /* If there's an entry in the map the no-warning bit must be set.= */ - gcc_assert (supp); - - gcc_checking_assert (nowarn_map); - nowarn_map->put (to_loc, *from_spec); - } - else - { - if (nowarn_map) - nowarn_map->remove (to_loc); - } + /* If there's an entry in the map the no-warning bit must be set. */ + gcc_assert (supp); + + gcc_checking_assert (nowarn_map); + nowarn_map->put (to_loc, *from_spec); } /* The no-warning bit might be set even if the map has not been consulte= d, or=