[PATCH] D77168: Add a flag to debug automatic variable initialization

Fangrui Song via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Apr 1 12:57:25 PDT 2020


MaskRay added a comment.

In D77168#1955500 <https://reviews.llvm.org/D77168#1955500>, @jfb wrote:

> In D77168#1955450 <https://reviews.llvm.org/D77168#1955450>, @jcai19 wrote:
>
> > In D77168#1955312 <https://reviews.llvm.org/D77168#1955312>, @jfb wrote:
> >
> > > Do you not think `pragma` is a more general approach? That's what's used in a bunch of other cases, and I'd like to see it attempted here.
> >
> >
> > Yes I absolutely agree pragma is a great way to bisect and will work in many scenarios, and the result is clear once the bisection is done. But like @srhines said, doing this one function at a time is preferable but not always possible (or maybe we can wrap consecutive functions within the same pragma push/pop pair? I tried to verify but ran into error: attribute 'uninitialized' is not supported by '#pragma clang attribute), and automating it is more difficult. From this perspective, I think the proposed patch is complementary to pragma and not meant to replace it.
>
>
> Right, support needs to be added, and I was wondering if you'd want to do this because it seems like a tool that would help you out.


My understanding is that we can invent a compiler option to add `#pragma clang attribute push` for declarations satisfying some criteria (e.g. first N)? No source is modified. This option can potentially be useful for other attributes which are orthogonal to their functionality (concrete examples: sanitizer/XRay attributes). If we go that route, I agree that this proposed -ftrivial-auto-var-init-stop-after= does not seem that useful.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D77168





More information about the cfe-commits mailing list