On 1/6/25 7:11 AM, Qing Zhao wrote:
Given it doesn't cause user visible UB, we could insert the trap *before* the
UB inducing statement. That would then make the statement unreachable and it'd
get removed avoiding the false positive diagnostic.
Yes, that’s a good idea.
However, in order to distinguish a user visible UB and a UB in the IL that is
introduced purely by compiler, we might need some new marking in the IR?
I don't think we've ever really tackled that question; the closest I can
think of would be things like integer overflow which we try to avoid
allowing the compiler to introduce. If we take the integer overflow as
the model, then that would say we should be tackling this during loop
unrolling.
jeff