From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 32BBE3858418; Fri, 12 May 2023 14:32:43 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 32BBE3858418 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1683901963; bh=tIDGALqxOac5uwJpBOnF5fO3USUSTHnxmAbfuDbrW/E=; h=From:To:Subject:Date:In-Reply-To:References:From; b=uvFahz9ovskeBhNt6a4Xbozf7y1d0nWFgvSzSIP31WtCWp56pZk5PUL7kqa8WRaZ+ ZS/XSF5gR9Zain1LIlT4v6XlNjWNbWl/jGX+K4yNw3dDd+txs90c6fE5U7AWFceBot SvMxanOSd+9Pklc4WptF83GKnoDj1F7mZ6Ib6jB4= From: "yann at droneaud dot fr" To: gcc-bugs@gcc.gnu.org Subject: [Bug c/109828] C2x:static compound literal (with flexible array) in initializer leads to invalid size and ICE Date: Fri, 12 May 2023 14:32:42 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: c X-Bugzilla-Version: 13.1.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: yann at droneaud dot fr X-Bugzilla-Status: UNCONFIRMED 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=3D109828 --- Comment #2 from Yann Droneaud --- (In reply to Yann Droneaud from comment #0) > The following code is badly compiled by GCC 13.1: >=20 > struct s { int i; char c[]; }; >=20 > const struct s s =3D { .c =3D "0", }; > const struct s *r =3D &(constexpr struct s) { .c =3D "1", }; > const struct s *t =3D &(static struct s) { .c =3D "2", }; >=20 > Targetting x86-64 / amd64, compiling this with gcc -std=3Dgnu2x -S, produ= ces > surprising large .zero directive: >=20 > s:=20 > .zero 4 > .string "0" > __compound_literal.0: > .zero 4 > .string "1" > .zero 18446744073709551613 > .zero 1 > r: > .quad __compound_literal.0 > __compound_literal.1: > .zero 4 > .string "2" > .zero 18446744073709551613 > .zero 1 > t: > .quad __compound_literal.1 >=20 > When asked to assemble that, binutils' as complains: $ gcc -std=3Dgnu2x nice.c -c /tmp/ccZEWv73.s: Assembler messages: /tmp/ccZEWv73.s:17: Warning: .space repeat count is zero, ignored /tmp/ccZEWv73.s:32: Warning: .space repeat count is zero, ignored=