From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 44A083884F86; Fri, 9 Dec 2022 19:18:03 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 44A083884F86 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1670613483; bh=UWoKyB8MuL8cj6PQnf6OpetAyufL4tQ2zsbkm56va1o=; h=From:To:Subject:Date:In-Reply-To:References:From; b=kdNCZ5LknFWhUoom/WT8sJ3QUQLqok0hrvtt2CmiN6kkWM0vk6E+p1FzoQKEhC4hV HRqp8xZUU/Yx9E+crXh3eJPCA1GNa6hxs5V+vwhFEepId9cx6VA/zWAdSvRJBoJzDM TKPlSva9dWXW3leMjp1uvpRnijYzlaN3BSwBKFZw= From: "colomar.6.4.3 at gmail dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug middle-end/108036] [11/12/13 Regression] Spurious warning for zero-sized array parameters to a function Date: Fri, 09 Dec 2022 19:18:03 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: middle-end X-Bugzilla-Version: 12.2.0 X-Bugzilla-Keywords: diagnostic X-Bugzilla-Severity: normal X-Bugzilla-Who: colomar.6.4.3 at gmail 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: 11.4 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=3D108036 --- Comment #3 from Alejandro Colomar --- Hi Andrew! Just a few nitpicks: - In the first testcase you posted, the [] is missing the 0: [0]. - In the reduced test case, you call the pointer to one past the end as 'e= nd'. That is misleading, since 'end' is commonly also used for pointers to the = last byte in an array, normally the NUL byte in strings. Using the term 'end' meaning one-past-the-end is likely to end up in off-by-one errors. So much that I found a few of them for exactly that reason this week :) This last point is why I like using array syntax, so I can clrealy specify 'end[1]' and 'past_end[0]', and they are clearly different things. Cheers, Alex=