From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id E77A93858D33; Mon, 23 Jan 2023 21:30:34 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org E77A93858D33 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1674509434; bh=xxP9+4BwLF3nw1xZTdoH3iROefYq1DQLGiazRp9nfZE=; h=From:To:Subject:Date:In-Reply-To:References:From; b=kgrvif7tPXEW73VVrOFb2N8Hz5PPBkcgxfG5HEjmv+GpGB/yZj4BV8JZdSKSNIrYn QpfDvIcfzECWbhP/WfaG1YALWXKC/Pz5JQkeG/yLYc8aMbCFDIjVqpa/HgvafA+1xY 3WLBXdqNFenIiKZ5BkUc4EU43d9MDoNhEmueXPGw= From: "siddhesh at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/107952] tree-object-size: inconsistent size for flexible arrays nested in structs Date: Mon, 23 Jan 2023 21:30:34 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: tree-optimization X-Bugzilla-Version: 13.0 X-Bugzilla-Keywords: wrong-code X-Bugzilla-Severity: normal X-Bugzilla-Who: siddhesh at gcc dot gnu.org X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: siddhesh 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=3D107952 --- Comment #8 from Siddhesh Poyarekar --- (In reply to qinzhao from comment #7) > (In reply to Richard Biener from comment #1) > > GCC considered this as a flex-array.=20 >=20 > do you mean for the following example: >=20 > typedef struct { > char pad; > char data[]; > } F2; >=20 > typedef struct { > unsigned pad; > F2 flex; > } S2; >=20 > although C standard disallow the above, GCC extension treats S2.flex.data= as > a flex-array?=20 >=20 > How about: >=20 > typedef struct { > char pad; > char data[]; > } F2; >=20 > typedef struct { > F2 flex; > unsigned pad; > } S2; >=20 > do we have any documentation on this Gcc extension? There's an open bug to document these semantics: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D77650=