On Tue, Aug 5, 2014 at 4:20 PM, Nico Weber <[email protected]> wrote:
> The undefined behavior isn't the check, but the code that preceded it and
> that made someone put in the fix:
>
> int* a = nullptr;
> int& ra = *a; // Undefined! But also harmless in practice.
>
> if (a == 5) {} // Crash! Better "fix" this by instead writing:
> if (&a && a == 5) {} // No crash! Except if the compiler rightfully
> optimizes away the &a check.
>
> If you don't have an ubsan bot, then it's possible that your code has
> references to null. That's undefined, but used to be safe in practice – but
> now that clang marks addresses of references as non-null, it isn't
> anymore. Wtautological-undefined-compare catches some of these places.
>
Yea, I'm just pointing out that I can see an argument where its hard to
argue that we shouldn't turn this warning off on code that doesn't care
about tautological comparisons... =/ I don't really have a better idea of
how to organize them.
_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits