https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88771

--- Comment #8 from Alexander Monakov <amonakov at gcc dot gnu.org> ---
Yeah, on GCC users' side I think there's a demand for both: treating UB as
unreachable (e.g. on tiny systems with heavy program size constraints) and
transforming UB to a trap briefly annotated with source location information.

In this particular testcase the warning looks like a false positive because
it's emitted on a copy of the original statement that is only called on a
specialized path, if f==-1 (and will surely invoke UB there). In general I'm
afraid it's impossible to say which copy is specialized (e.g. when you unswitch
a loop neither of the two copies is more "specific" than the original), but
perhaps here VRP threading could set some TREE_NO_WARNING flags reasonably?

I think it might have been asked already, but isn't it possible to emit such
warnings before CFG transformations may have taken place?

Reply via email to