devsw-prayas wrote:

@zwuis Fair, and you're right, not a nitpick. The whole-function check is
weaker than what -Wuninitialized already does with its CFG dataflow, so as-is
this doesn't add much over that.

Plan: swap it for a per-candidate-scalar shadow i1. Resets to false at the
declaration (so loops work correctly), gets set to true at every write/init,
checked at each flagged read. That makes it path sensitive, e.g.
`if (cond) x = 1; use(x);` would trap exactly when cond was false at runtime.

Cost is one alloca + one store per write + one load/branch per read, for
candidate scalars only. Given -fsanitize=undefined is supposed to stay cheap,
wanted to check before implementing: fine as part of the Undefined group, or
would you rather this sit behind its own flag?

Holding off on the implementation until we land on this.

https://github.com/llvm/llvm-project/pull/207529
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to