From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id C82673858D28; Wed, 24 May 2023 21:50:47 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org C82673858D28 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1684965047; bh=NNBh2yGChodPtlrsY5H3w2VLzTu51i0X/qpoWqgQJzQ=; h=From:To:Subject:Date:In-Reply-To:References:From; b=bQnfp/RrZnDip4f2AHCKwbP8tNPkSv64h5Vh6Co9+drUKdA4itTQcY3cB5ekh5av7 fDmd06Uh6qHYRJLTeF1pkyJtF4lVPd7l9jFQz8ldJfST8CYfE9fH3SMsULEHjDyN7s HpOG5wgnjeEzqq+b+j302pA+1uN3mYWoQS1cNMfw= From: "joseph at codesourcery dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug c/109956] GCC reserves 9 bytes for struct s { int a; char b; char t[]; } x = {1, 2, 3}; Date: Wed, 24 May 2023 21:50:47 +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: 14.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: trivial X-Bugzilla-Who: joseph at codesourcery dot com 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=3D109956 --- Comment #6 from joseph at codesourcery dot com --- For the standard, dynamically allocated case, you should only need to=20 allocate enough memory to contain the initial part of the struct and the=20 array members being accessed - not any padding after that array. (There=20 were wording problems before C99 TC2; see DR#282.)=