From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id C3F243858C60; Fri, 28 Apr 2023 05:17:30 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org C3F243858C60 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1682659050; bh=kXjCxJv/UaaVdFMqRJyAkiVlXci3Z7DUD2IePYqQ7GQ=; h=From:To:Subject:Date:In-Reply-To:References:From; b=E7+qM3HjL1OFanIEY0IAwjX1veJOOy1vVttk1xQ14DI19GzH8vE/6bln2E2asEbqq ckFgWp5dRyjPmQozkWGkAvcsWZn+ylf1/BBdwz51HvMcVCMZlqVxoEqJPOrMDMihKc ZFRj22lgWT6iOtjvZCvvP3Nfrzr2RwCxzr8DeVXg= From: "lh_mouse at 126 dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug target/105523] Wrong warning array subscript [0] is outside array bounds Date: Fri, 28 Apr 2023 05:17:29 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: target X-Bugzilla-Version: 12.0 X-Bugzilla-Keywords: diagnostic X-Bugzilla-Severity: normal X-Bugzilla-Who: lh_mouse at 126 dot com X-Bugzilla-Status: NEW X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: saaadhu 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=3D105523 --- Comment #31 from LIU Hao --- (In reply to Andrew Pinski from comment #24) > The warning is there for the above case really (and similar ones with str= uct > offsets). Where you originally have a null pointer and have an offset from > there; by the time the warning happens, the IR does not know if it was > originally from an offset of a null pointer or if the value was written i= n. I understand that completely, but it does not justify the confusion. Someth= ing like 'warning: array subscript 0 is outside array bounds of' says nothing a= bout null pointers, and is thus misleading. It is addition of a non-zero offset = to a null pointer that the warning really belongs to.=