[PATCH] D68115: Zero initialize padding in unions

Vitaly Buka via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Jan 14 12:59:34 PST 2020


vitalybuka added a comment.

In D68115#1819418 <https://reviews.llvm.org/D68115#1819418>, @aaron.ballman wrote:

> In D68115#1811091 <https://reviews.llvm.org/D68115#1811091>, @lebedev.ri wrote:
>
> > In D68115#1811089 <https://reviews.llvm.org/D68115#1811089>, @hubert.reinterpretcast wrote:
> >
> > > In D68115#1810891 <https://reviews.llvm.org/D68115#1810891>, @lebedev.ri wrote:
> > >
> > > > Does this have to be an unilateral change,
> > > >  likely penalizing non-`-ftrivial-auto-var-init=` cases,
> > > >  i.e. [why] can't it be **only** done for when `-ftrivial-auto-var-init=` is enabled?
> > >
> > >
> > > We left off near that conclusion (https://reviews.llvm.org/D68115#1686887);
> >
> >
> > Would be great if @rsmith / @aaron.ballman could comment on that
>
>
> I don't have super strong opinions on it, but I think a separate feature for zeroing union padding is what gives users the most flexibility.
>
> In D68115#1811089 <https://reviews.llvm.org/D68115#1811089>, @hubert.reinterpretcast wrote:
>
> > A separate option to control zeroing for union padding would help in cases where the zeroing does not happen for reasons other than `-ftrivial-auto-var-init`.
>
>
> Agreed.


I would be happy to finish this patch if we agree on something.

So if I understand this the proposal is to have something like -fzero-union-padding which is off by default.
When it's OFF compiler will continue to do whatever it does now.
When it's ON it will set zeroes into padding with or without -ftrivial-auto-var-init.
Is this correct?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D68115/new/

https://reviews.llvm.org/D68115





More information about the cfe-commits mailing list