From: Aaron Peter Bachmann <aaron_ng@inode.at>
To: musl@lists.openwall.com
Subject: [musl] Re: Re: Potential bug in __res_msend_rc() wrt to union
Date: Tue, 19 Mar 2024 17:32:09 +0100 [thread overview]
Message-ID: <cfc74b71-d018-4a57-9558-4a43e6978658@inode.at> (raw)
On Tue, 19 Mar 2024 09:18:33 -0400 Rich Felker wrote:
>C11 adds (in 6.7.9 ¶10):
>
> "if it is a union, the first named member is initialized
> (recursively) according to these rules, and any padding is
> initialized to zero bits;"
>
>where C99 just had (6.7.8):
>
> "if it is a union, the first named member is initialized
> (recursively) according to these rules."
>
>So I think C11 and later actually require the full zero
>initialization of all bits, and clang is just wrong.
"all bits" is a bit misleading, as it does not cover padding
(alignment holes and anonymous bit-fileds and holes due to bit-fields).
At least that is what I think the standard says.
The compiler is likely to implement "all bits".
C23 ... = { } - without 0 between the braces - really includes "all bits" but even recent C++ does not.
Regards, Aaron Peter Bachmann
reply other threads:[~2024-03-19 18:02 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=cfc74b71-d018-4a57-9558-4a43e6978658@inode.at \
--to=aaron_ng@inode.at \
--cc=musl@lists.openwall.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/musl/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).