[PATCH] D68115: Zero initialize padding in unions

Hubert Tong via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Jan 8 16:05:47 PST 2020


hubert.reinterpretcast added a comment.

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); however, `-ftrivial-auto-var-init=` merely increases the chance that code expecting the zeroing to occur would break. 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`.


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