[PATCH] D125142: [clang][auto-init] Remove -enable flag for "zero" mode

Aaron Ballman via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Sep 15 06:55:52 PDT 2022


aaron.ballman added a comment.

In D125142#3782296 <https://reviews.llvm.org/D125142#3782296>, @xbolva00 wrote:

> In D125142#3782244 <https://reviews.llvm.org/D125142#3782244>, @nickdesaulniers wrote:
>
>> @rsmith can we get some guidance here?  Has your opinion changed in the time since GCC has been shipping this?
>
> Maybe we should now ask @aaron.ballman as he is now main code owner.

I agree with @rsmith that this is creating a language dialect, and it's creating one that at least WG21 has shown divided opinions on. So I think it is worth exploring the idea he had in https://reviews.llvm.org/D79249 in so much as that comes closer to meeting our bar for language extensions. However, I still think GCC compatibility is important in how we expose the functionality. If we spell the option `-ftrivial-auto-var-init=zero`, it should work the same as GCC (modulo bugs); the alternative would cause too much confusion in the field, I think.

That said, there's significant deployment experience with the zeroing flag, and some committees (like WG14) honor prior art when considering standardization. That there's now one very popular C implementation exposing this functionality for users makes it slightly more likely WG14 would be interested in standardizing something in this realm. Having a second very popular C implementation further strengthens that case. So while WG21 has shown divided opinions, WG14 hasn't been consulted. Putting a paper in front of them that shows some signs of life (which we could do already today without any changes here) would remove the concerns regarding meeting our bar for an extension if we wanted the same semantics as GCC. However, I'm still skeptical of WG14 adopting such a proposal, so it's by no means a slam dunk. Despite that and given the success of the feature in GCC, I'm less concerned about the creation of a language dialect in this particular case. We've done that before (many of our floating-point math flags like `-ffast-math` and `-fhonor-nans` come to mind) and we have sufficient evidence that users are making use of `-enable-trivial-auto-var-init-zero-knowing-it-will-be-removed-from-clang`: https://sourcegraph.com/search?q=context:global+enable-trivial-auto-var-init-zero-knowing-it-will-be-removed-from-clang+-file:.*test.*+-file:Options.td&patternType=standard

tl;dr: I think it's defensible to move forward with this patch as-is, especially given that we've been threatening to remove the -cc1 flag (we're nearing a point where we either need to support this feature or drop it and I think people would strongly prefer we support it).


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D125142



More information about the cfe-commits mailing list