From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 8EF2E3858C74; Fri, 28 Apr 2023 05:25:00 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 8EF2E3858C74 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1682659500; bh=w8qKHBftVDGsSbOJUJrFlhroB4xu/a5NpZ7YSC/2luA=; h=From:To:Subject:Date:In-Reply-To:References:From; b=uGGt/m3LTEe8g0sy/h7R7nJm/GXGhfYskKYN5g+U+HNU2XLy9VlRJzru4v3ZQqPBa VGZjcDLg6UrkVAnMehGRQAb2c/9sS8OgGFseMHnTl6umMZh4HM3CeQ1tBjqcoWSvNQ pZWQhr5Yh+UNivN9ePigZM0OcfjdbYg562XLvV9o= From: "pinskia at gcc dot gnu.org" 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:25:00 +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: pinskia at gcc dot gnu.org 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 #32 from Andrew Pinski --- (In reply to LIU Hao from comment #31) > (In reply to Andrew Pinski from comment #24) > > The warning is there for the above case really (and similar ones with s= truct > > offsets). Where you originally have a null pointer and have an offset f= rom > > 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= in. >=20 > I understand that completely, but it does not justify the confusion. > Something like 'warning: array subscript 0 is outside array bounds of' sa= ys > nothing about null pointers, and is thus misleading.=20 Actually since GCC 13, there is an additional note specifically to fix that misleading part: cc1plus: note: source object is likely at address zero=