[cfe-commits] [PATCH] Add -fsanitize= command line argument to control -fcatch-undefined-behavior, -faddress-sanitizer, and -fthread-sanitizer

Richard Smith richard at metafoo.co.uk
Fri Nov 2 11:35:32 PDT 2012


On Thu, Nov 1, 2012 at 10:41 PM, Alexander Potapenko <glider at google.com> wrote:
> I haven't seen the patch yet, but here are two thoughts:
> - some tools may be incompatible with each other (e.g. ASan and TSan), so we
> shouldn't allow to use them together;

Patch 2 adds a diagnostic if the user attempts to combine checkers
which require the asan runtime with checkers which require the tsan
runtime. (Currently, it also diagnoses if either of those is combined
with any of the ubsan checks, but that's a limitation I aim to remove
very soon).

> - there are many users of TSan and ASan, thus we can't easily rename the
> corresponding command line options. The right thing to do is to make
> -fsanitize fully functional, announce that and then remove the existing
> flags.

I'm undecided on this. The patch, as it stands, continues to allow the
older options for compatibility. I don't expect them to bring any
significant maintenance costs. On the other hand, the -f*-sanitizer
switches haven't been around for very long, so if there's consensus
that they should be removed, I'd be OK with that too.

> I'm also unsure whether having such an umbrella flag for such different
> tools won't confuse the users.

>From an end-user's perspective, I think the tools are more similar
than they are different, and having a mechanism to enable the ubsan
checkers individually which can't also be used for asan and tsan would
be surprising -- especially since there are a couple of ubsan checkers
which would need the asan runtime (I'm not sure if any would need the
tsan runtime).



More information about the cfe-commits mailing list