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

JF Bastien via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Apr 16 20:33:52 PDT 2020


jfb added a comment.

In D77168#1988049 <https://reviews.llvm.org/D77168#1988049>, @srhines wrote:

> `pragma clang attribute` is interesting, but how do you apply that in a selective fashion to local variables (especially in a way that can be automated)? At first, I didn't think the goal for this should be to create a frequently used option for **most** end users, but I do think that it could be quite useful for more folks when debugging, especially if it is easy to automate (which optimization-fuel approaches are, while pragmas are not).


`__attribute__((uninitialized))` for more selectiveness :)

Of course, not automated. In general we don't really automate compiler things of this sort, say UBSan. OptRemarks is the best we really have to dig into these things. One other option would be to truly randomize the init pattern: emit a handful of different byte patterns, and then see the crash caused by a different pattern, and track it back to which local variable got that byte pattern.


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