This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH][PR sanitizer/64354] Define __SANITIZE_THREAD__ and __SANITIZE_UNDEFINED__ macros if corresponding switches are enabled.
- From: Jakub Jelinek <jakub at redhat dot com>
- To: Maxim Ostapenko <m dot ostapenko at samsung dot com>
- Cc: GCC Patches <gcc-patches at gcc dot gnu dot org>, Yuri Gribov <tetra2005 at gmail dot com>, Slava Garbuzov <v dot garbuzov at samsung dot com>
- Date: Thu, 19 May 2016 13:49:41 +0200
- Subject: Re: [PATCH][PR sanitizer/64354] Define __SANITIZE_THREAD__ and __SANITIZE_UNDEFINED__ macros if corresponding switches are enabled.
- Authentication-results: sourceware.org; auth=none
- References: <573CA781 dot 50505 at samsung dot com> <20160518173601 dot GS28550 at tucnak dot redhat dot com> <573DA810 dot 9090308 at samsung dot com>
- Reply-to: Jakub Jelinek <jakub at redhat dot com>
On Thu, May 19, 2016 at 02:48:32PM +0300, Maxim Ostapenko wrote:
> On 18/05/16 20:36, Jakub Jelinek wrote:
> >On Wed, May 18, 2016 at 08:33:53PM +0300, Maxim Ostapenko wrote:
> >>when compiling with -fsanitize=address we define __SANITIZE_ADDRESS__
> >>macros, but we don't do this for -fsanitize=thread and -fsanitize=undefined.
> >>Perhaps we should be more symmetric here and define corresponding
> >>__SANITIZE_THREAD__ and __SANITIZE_UNDEFINED__ macros respectively?
> >>
> >>I added two simple test cases to c-c++-common/{ub, t}san/ directories that
> >>just verify if __SANITIZE_THREAD__ (__SANITIZE_UNDEFINED__) is defined. Is
> >>that a proper way how we check that the macros defined correctly? Does this
> >>patch looks reasonable?
> >I can understand __SANITIZE_THREAD__, but I fail to see what
> >__SANITIZE_UNDEFINED__ would be good for, especially when it is not just
> >a single sanitizer, but dozens of them.
>
> Ok, I've removed -fsanitize=undefined part from this patch, is it OK now? As
> for UBSan, perhaps it's not desirable to define separate macros for each
> -fsanitize={null, ...} switch.
>
> >
> > Jakub
> >
> >
>
> gcc/ChangeLog:
>
> 2016-05-19 Maxim Ostapenko <m.ostapenko@samsung.com>
>
> PR sanitizer/64354
> * cppbuiltin.c (define_builtin_macros_for_compilation_flags): Add new
> builtin __SANITIZE_THREAD__ macros for fsanitize=thread switch.
> * doc/cpp.texi: Document new macros.
>
> gcc/testsuite/ChangeLog:
>
> 2016-05-19 Maxim Ostapenko <m.ostapenko@samsung.com>
>
> PR sanitizer/64354
> * c-c++-common/tsan/sanitize-thread-macro.c: New test.
Ok.
Jakub