From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 6AEDD385840C; Thu, 7 Mar 2024 10:18:13 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 6AEDD385840C DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1709806693; bh=FbvEIceVh8cbhUrSeifPSgThfHQqoL5uyMh81s5gF/g=; h=From:To:Subject:Date:In-Reply-To:References:From; b=dTeZjaGJ4aAUj45XoMj2gVxQAgT68APBSNQQlDQiHrvMdPUgm+DNjH+83oEXELtwI lDuhMJqz+1NzqTtwhkVTyCylOHMqNYocI11X23S+/R0NdgldQgIoz+OLaAc11c3Rli Q50Li9e9Q9m+tJJSQ6/SoRIKNLDmFepD36uaJ+G0= From: "daniel.lundin.mail at gmail dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug middle-end/108036] [11/12/13/14 Regression] Spurious warning for zero-sized array parameters to a function Date: Thu, 07 Mar 2024 10:18:12 +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: daniel.lundin.mail at gmail dot com X-Bugzilla-Status: NEW X-Bugzilla-Resolution: X-Bugzilla-Priority: P2 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: 11.5 X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: cc 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 Daniel Lundin changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |daniel.lundin.mail at gmai= l dot co | |m --- Comment #8 from Daniel Lundin --- I don't believe char past_end[0] is valid C, because it is an invalid array declaration. Unlike [] or [*] that declares an array of incomplete type.=20 Since it is a function parameter, it will of course later get adjusted to a pointer to the first element. But it still has to be a valid declaration to begin with. Similarly, char arr[][] is invalid because it remains an incomp= lete type after adjustment (see C17 6.7.6.4 =C2=A74). gcc does allow [0] as an extension since that was commonly used for purpose= s of implementing the "struct hack" back in the days before flexible array membe= rs were standardized. The conclusion ought to be that gcc should let [0] through if compiled in -std=3Dgnu23 mode but not in -std=3Dc23 and/or -pedantic.=