From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id A6D96385B833; Mon, 23 Mar 2020 23:52:25 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org A6D96385B833 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1585007545; bh=hlEtOR4xo7Uz7+cJQBOgm4eqGMrqd5y6kmVCsN/ZADQ=; h=From:To:Subject:Date:In-Reply-To:References:From; b=QdGwIwwvkEScCRh2AVz5jAuMB9u5Ch1YYis6OpEwq7HEswXY3V/i4tkACHWZVajNT dT7ZHDB3mAHXQtXa3HKLvOnbwH7yOysHzu8vtGDnP1MKhG1IfGUlnnmHXZkrOcCqK8 2yXbPSuVxKsiOLj0BKPpGfGZjOAJGmo5LlhCdOOI= From: "msebor at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug c/94247] Wrong char-subscripts warning for limited-range index Date: Mon, 23 Mar 2020 23:52:25 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: c X-Bugzilla-Version: 10.0 X-Bugzilla-Keywords: diagnostic X-Bugzilla-Severity: normal X-Bugzilla-Who: msebor at gcc dot gnu.org X-Bugzilla-Status: RESOLVED X-Bugzilla-Resolution: INVALID X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned 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 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, 23 Mar 2020 23:52:25 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D94247 --- Comment #7 from Martin Sebor --- (In reply to Jakub Jelinek from comment #6) > No, it diagnoses the main bug Nope, it does not. -Wchar-subscripts is designed and documented to diagnos= e a common cause of a bug. The actual bug itself (which, as noted in pr94182, = the manual neglects to describe) is in inadvertently using a negative index as a result of sign extension when a positive index is intended. When that cann= ot happen there is obviously no bug to diagnose. There's no doubt that there is room for improvement in both warnings. Some= of the false negatives might be avoidable by enhancing -Wchar-subscripts in the front-end (e.g., fixing the remainder of pr29455), but the better ROI is in continuing to improve -Warray-bounds (pr56456).=