[PATCH] Add new builtin __SANITIZE_UNDEFINED__ macros for fsanitize=undefined switch

Kamil Rytarowski n54@gmx.com
Sat Sep 21 15:30:00 GMT 2019


On 21.09.2019 16:51, Jakub Jelinek wrote:
> On Sat, Sep 21, 2019 at 01:31:10PM +0200, Kamil Rytarowski wrote:
>> GCC version of https://reviews.llvm.org/D52386
>>
>> 2019-09-21  Kamil Rytarowski  <n54@gmx.com>
>>
>> 	* cppbuiltin.c (define_builtin_macros_for_compilation_flags): Add new
>> 	builtin __SANITIZE_UNDEFINED__ macros for fsanitize=undefined switch.
>> 	* doc/cpp.texi: Document new macros.
>>
>> 	* c-c++-common/lsan/sanitize-undefined-macro.c: New test.
> 
> I fail to see a good use case for this, it will just lead people to add
> workarounds for ubsan diagnostics without actually fixing it for real in
> their production code.

It's needed in real production code in the NetBSD kernel/userland as
there are legitimate code paths that are not UBSan clean.

There is also a UBSan specific header that can be picked with this ifdef.

>  Also, -fsanitize=undefined is a collection of many
> different sanitizers.

I wrote a full UBSan kerne&userland&in-libc runtime so I am aware about
this, however I don't have a use case on fine-grained processor checks.

>  Those that want such macros to say provide libubsan
> definitions on their own can do that in their build system, next to
> -fsanitize=undefined provide their own -Dwhatever that will make that
> happen.

Do you see point in e.g. __SANITIZER_ADDRESS__ ?

This macro is intended to be used in public NetBSD system headers (as we
need it there) and you volunteer to patch scons, cmake, bmake, gmake,
gn, autotools etc for us?

> 
> 	Jakub
> 




-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: OpenPGP digital signature
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20190921/62548543/attachment.sig>


More information about the Gcc-patches mailing list