On 9/6/25 4:24 PM, Jakub Jelinek wrote:
On Sat, Sep 06, 2025 at 04:10:16PM +0200, Jason Merrill wrote:
3. Should the paddings of the auto variables or temporaries be zero-initialized
per the standard?
No.
Okay.
I disagree, I think the padding should also be initialized; the
specification says "the bytes comprising the storage for the object", not
just the value representation.
The paper (not in the proposed wording section though) says:
"As a caveat, padding bits in the source object continue to be considered
indeterminate, not erroneous, regardless of their origin."
Has that changed?
With the zero initialization which I'd like to see by default for -std=c++26
(unless one uses -ftrivial-auto-var-init=), even the padding bits will be
initialized for the .DEFERRED_INIT case, but for vars initialized with
DECL_INITIAL such a .DEFERRED_INIT is not emitted, but instead can do costly
__builtin_clear_padding after the initialization of the var. That is
something I wanted to avoid by default, unless user asks for it.
Hmm, the rest of https://eel.is/c++draft/basic.indet refers to the value
representation, so I guess you're right.
Jason