This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] Add command line parsing of -fsanitize
- From: Jakub Jelinek <jakub at redhat dot com>
- To: "Joseph S. Myers" <joseph at codesourcery dot com>
- Cc: Marek Polacek <polacek at redhat dot com>, GCC Patches <gcc-patches at gcc dot gnu dot org>
- Date: Mon, 17 Jun 2013 18:01:10 +0200
- Subject: Re: [PATCH] Add command line parsing of -fsanitize
- References: <20130614190439 dot GE20883 at redhat dot com> <20130617145930 dot GV2336 at tucnak dot redhat dot com> <Pine dot LNX dot 4 dot 64 dot 1306171552130 dot 10096 at digraph dot polyomino dot org dot uk>
- Reply-to: Jakub Jelinek <jakub at redhat dot com>
On Mon, Jun 17, 2013 at 03:52:54PM +0000, Joseph S. Myers wrote:
> On Mon, 17 Jun 2013, Jakub Jelinek wrote:
>
> > > +; What the sanitizer should instrument
> > > +Variable
> > > +unsigned int flag_sanitize
> >
> > Can't you just add Var(flag_sanitize) to the line after fsanitize= ?
>
> I think that would create a string variable, whereas an integer is what's
> wanted here.
We already have say:
Wstack-usage=
Common Joined RejectNegative UInteger Var(warn_stack_usage) Init(-1) Warning
Warn if stack usage might be larger than specified amount
that creates
#ifdef GENERATOR_FILE
extern int warn_stack_usage;
#else
int x_warn_stack_usage;
#define warn_stack_usage global_options.x_warn_stack_usage
#endif
so I guess UInteger Var(flag_sanitize) then would do the trick.
Though, now looking at it, -fsanitize={address,thread} aren't
RejectNegative, so they accept also -fno-sanitize=address etc.
Marek, thus your patch should handle that properly too, say if you do:
-fsanitize=undefined -fno-sanitize=shift
it should first or into the flag_sanitize bitmask SANITIZE_UNDEFINED
and then and it with ~SANITIZE_SHIFT.
Jakub