From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 204103858C2D; Mon, 7 Aug 2023 00:26:40 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 204103858C2D DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1691368000; bh=+2UcBWMqgVZQ14QQMOzUYQeeryB6EUy3cKgZA0qC8ao=; h=From:To:Subject:Date:In-Reply-To:References:From; b=JxU6N45ZwH5uEPlShCjSFV819ilegMB9wY8jUZludYtLIRj3Wge6n6jHPRxIsf4/b XgxtqP+QRhFJYVxlEmoZFJSX92S0Zj4Jn9uNU9sRQ22L+DV25O9HXqwqHAK2LLUHvF c0lrc69dfCE1citSa4yOHYaiY5NQXrVOBex2DE+E= 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 00:26:39 +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 #9 from Andrew Pinski --- +FAIL: c-c++-common/Wrestrict.c -Wc++-compat (test for excess errors) Excess errors: /home/apinski/src/upstream-gcc-git/gcc/gcc/testsuite/c-c++-common/Wrestrict= .c:684:3: warning: 'strcpy' accessing 2 bytes at offsets [0, 1] and 0 overlaps betwee= n 1 and 2 bytes at offset [0, 1] [-Wrestrict] T (8, "0", a + r, a); /* { dg-warning "accessing between 1 and 2 bytes = at offsets \\\[0, 1] and 0 overlaps up to 2 bytes at offset \\\[0, 1]" "strcpy= " { xfail *-*-*} } */ Looks like the dg-warning needs to be updated and the xfail removed. we have: ``` strcpy (a+[0,1], a); ``` /home/apinski/src/upstream-gcc-git/gcc/gcc/testsuite/c-c++-common/Wrestrict= .c:863:3: warning: 'strncpy' accessing 1 byte at offsets 0 and [0, 1] may overlap 1 b= yte at offset 0 [-Wrestrict] T ("0123", a, a + i, 1); In this case a and a+[0,1] can overlap for strncpy even for size of 1. /home/apinski/src/upstream-gcc-git/gcc/gcc/testsuite/c-c++-common/Wrestrict= .c:866:3: warning: 'strncpy' accessing 2 bytes at offsets 0 and [0, 1] overlaps betwe= en 1 and 2 bytes at offset [0, 1] [-Wrestrict] T ("0123", a, a + i, 2); /* { dg-warning "accessing 2 bytes at offsets 0 and \\\[0, 1] may overlap 1 byte at offset 1" "strncpy" { xfail *-*-* } } */ Just like the first case.=