From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 5C53B3858438; Mon, 7 Aug 2023 01:52:14 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 5C53B3858438 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1691373134; bh=adZLCMXyXlY8o6FK7EwBJTwsn20rbsa4kLYqAK/hvl0=; h=From:To:Subject:Date:In-Reply-To:References:From; b=sclwke71Ykr9VnmTC/5hFtoNuz5XnHlhJ6DW3H37mi1KAJjc4iG/uH84ZX2JPK+QP 8udiGCDhpKBR1x3XcPY0i3RkEHJMvAE3GhBInvPdnEQvpy1XNUsPxn/0khCVSeUsg8 NRGYAXbcRlkJBg5VeT+w9WJ9G4MYXPNqfVR/fmU8= From: "pinskia at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/109959] `(a > 1) ? 0 : (a == 1)` is not optimized when spelled out at -O2+ Date: Mon, 07 Aug 2023 01:52:14 +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: 14.0 X-Bugzilla-Keywords: missed-optimization X-Bugzilla-Severity: enhancement X-Bugzilla-Who: pinskia at gcc dot gnu.org X-Bugzilla-Status: ASSIGNED X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: pinskia 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=3D109959 --- Comment #10 from Andrew Pinski --- (In reply to Andrew Pinski from comment #9) > +FAIL: c-c++-common/Wrestrict.c -Wc++-compat (test for excess errors) > Excess errors: This is just like the builtin-sprintf-warn-23.c xfail; well except there the warning message was already correct. Note if we change signed_range in gcc.dg/range.h to: static inline ptrdiff_t signed_range (ptrdiff_t min, ptrdiff_t max) { ptrdiff_t val =3D signed_value (); if (val < min || max < val) __builtin_unreachable(); return val; } We get the same warning as we get with this patch. So I am definitely going= to add/change the dg-warning here because that will be the correct fix.=