[cfe-dev] making -ftrivial-auto-var-init=zero a first-class option

Kees Cook via cfe-dev cfe-dev at lists.llvm.org
Wed Apr 22 10:40:55 PDT 2020


On Tue, Apr 21, 2020 at 04:54:25PM -0700, Richard Smith wrote:
> The existence of the
> --long-ugly-flag-name-that-says-we'll-remove-the-feature is the way we
> currently try to avoid introducing a language dialect. If we remove that
> flag as is proposed, then we are effectively relitigating the question of
> whether to have the feature at all.

What about renaming the enable flag so it doesn't imply that zero-init
is going to be removed?

> And indeed it might even be OK if the initial behavior is that we *always*
> zero-initialize (as Philip asked), so long as our documentation clearly
> says that we do not guarantee that the value will be zero (only that we
> guarantee that *if the program continues*, the value will be zero), and our
> intent is that we may still produce traps or otherwise abort the
> computation.

Right -- I would see adding a trap path as a nice improvement. I still
think it'll be be too much overhead, though, given needing to check all
corners of a struct: accessing any padding bytes would need to trap,
etc.

-- 
Kees Cook


More information about the cfe-dev mailing list