[cfe-dev] [RFC] automatic variable initialization

JF Bastien via cfe-dev cfe-dev at lists.llvm.org
Tue Nov 27 13:49:59 PST 2018



> On Nov 27, 2018, at 10:16 AM, David Blaikie via cfe-dev <cfe-dev at lists.llvm.org> wrote:
> 
> 
> 
> On Mon, Nov 26, 2018 at 6:55 PM Reid Kleckner <rnk at google.com <mailto:rnk at google.com>> wrote:
> On Mon, Nov 26, 2018 at 6:43 PM Kostya Serebryany via cfe-dev <cfe-dev at lists.llvm.org <mailto:cfe-dev at lists.llvm.org>> wrote:
> On Sat, Nov 17, 2018 at 9:00 AM David Blaikie via cfe-dev <cfe-dev at lists.llvm.org <mailto:cfe-dev at lists.llvm.org>> wrote:
> Would it be that drastic to have this require a code change/compiler rebuild to enable? It could be designed so the change is small/easy (changing a constant) but that the default compilers we all ship around (& especially not the official releases) don't allow access to this functionality.
> 
> Anyone wanting to gather data would have to make this small change, rebuild their compiler, build their target with this feature & gatehr results from there.
> 
> This will cripple our ability to do measurements because in many cases we can only build things with whatever is the production compiler. 
> I'd rather just rename the flag to something like  -ftrivial-auto-var-init=zero-SCARY-WARNING-ABOUT-VOID-WARRANTY-GOES-HERE
> 
> Reminds me of -fheinous-gnu-extensions. ;-)
> 
> Pretty much - and I don't think any choice of spelling is bad enough that it'd make it substantially less likely that people would end up depending on the behavior in their non-buggy codepaths. Once the flag is written into someone's build system, there it is... even if it's absurdly long/verbose/angry/whatever, generally it'll slip under the radar after it's written into the build system.

I’d like to get us to a point where we all agree to a solution. I think these statements are true:

0. We want to minimize the size / perf hit because that’ll maximize adoption.
1. We need to gather size / perf data of uninit versus zero-init versus pattern-init.
2. The easier it is to gather data, the faster it’ll be to find and address regressions we don’t know about (likely in other people’s codebases).
3. We don’t want to have zero-init long term, and we don’t want people to rely on it.
4. Giving the flag / attribute an ugly name won’t prevent people from using them.

These seem at odds because we don’t usually remove flags. Can we purposefully change the name of the zero-init flag / attribute on every release, until we finally remove it? Or is the only option to give up on 2. And add friction when trying to collect data?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20181127/76c3dcf3/attachment.html>


More information about the cfe-dev mailing list