From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 01A5D3858C50; Tue, 25 Apr 2023 07:30:13 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 01A5D3858C50 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1682407814; bh=0glM3ntSK+h4lVhGCTnV0akhzbTVA68vQWltHpaDpdE=; h=From:To:Subject:Date:In-Reply-To:References:From; b=Imy6Xuf5FEkaFuSbPRmNcWxPJ4bDSraw5YNljFKTUoZTt6Yp84qlLX7G0LEtwYC1e NKZ5alO7sn0CuVj8oNHbVr8y10A2YZ490cyLC7CKhViWQrp/4gVcRv6lD2q4kgcwg0 +NSKjRP1DmVR0XK/9uNVkv07EQZrpsWykDknyhGE= From: "david at westcontrol dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug target/105523] Wrong warning array subscript [0] is outside array bounds Date: Tue, 25 Apr 2023 07:30:13 +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: david at westcontrol dot com X-Bugzilla-Status: NEW X-Bugzilla-Resolution: 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 List-Id: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D105523 --- Comment #21 from David Brown --- (In reply to Andrew Pinski from comment #1) > --param=3Dmin-pagesize=3D should be set to 0 for avr as zero is a valid a= ddress. Is there any convenient description of "min-pagesize" ? The user manual is unhelpful: "Minimum page size for warning purposes." Your comment here suggests it is connected to whether zero is a valid address or not, which d= oes not sound at all related to the issue here. (But you are correct that for = the AVR, and many embedded systems, accessing memory at address zero is valid.) Testing (on godbolt) shows that setting "--param=3Dmin-pagesize=3D0" does s= top this warning triggering. But this is an issue that affects all systems for which the user might want to convert a fixed value to an address - i.e., all embe= dded systems, and perhaps device drivers or other low-level code on bigger syste= ms.=20 Is setting "min-pagesize" to 0 actually a fix, or is it a workaround, and w= ill it have other effects on static warning checks and/or code generation? A workaround is, of course, helpful - especially since this can be added to peoples CFLAGS list.=