On Thu, 28 Oct 2021, Hans-Peter Nilsson wrote:

> On Wed, 20 Oct 2021, Richard Biener via Gcc-patches wrote:
> 
> > This maps -ftrapv to -fsanitize=signed-integer-overflow
> > -fsanitize-undefined-trap-on-error,
> 
> Isn't that UBSAN target-dependent, i.e. not supported on all
> targets, whereas -ftrapv is just about universally supported?

I think only libubsan from libsanitizer has target dependences,
-fsanitize-undefined-trap-on-error specifically avoids requiring
-lubsan and thus should be fine in that regard.

> I.e. isn't this patch breaking -ftrapv for some targets?

I don't think so.  As proposed the patch would make -ftrapv
non-functional for non-C/C++ languages.

But Jakub already stated he didn't like this simple approach.

Note that the UBSAN instrumentation in the C/C++ frontends has
the advantage over anything done in the middle-end that it
reliably happens before early folding which might influence
what and how things are instrumented.  The next obvious places
to instrument things would be the gimplifier or the ubsan pass.

Richard.

Reply via email to