r177061 - [ASan] Make -fsanitize=address imply -fsanitize=init-order (if the latter is not explicitly disabled).

Alexey Samsonov samsonov at google.com
Thu Mar 14 13:20:25 PDT 2013


On Thu, Mar 14, 2013 at 7:03 PM, David Blaikie <dblaikie at gmail.com> wrote:

>
> On Mar 14, 2013 5:16 AM, "Alexey Samsonov" <samsonov at google.com> wrote:
> >
> > Author: samsonov
> > Date: Thu Mar 14 07:13:27 2013
> > New Revision: 177061
> >
> > URL: http://llvm.org/viewvc/llvm-project?rev=177061&view=rev
> > Log:
> > [ASan] Make -fsanitize=address imply -fsanitize=init-order (if the
> latter is not explicitly disabled).
>
> Should we consider making it always implied even if it has been previously
> explicitly disabled? That's how warning flags work, for example, so users
> are used to that sort of precedence/ordering system
>
Hm, this makes sense. I think I'll change this to your way tomorrow. Thanks!


> >
> > Modified:
> >     cfe/trunk/lib/Driver/Tools.cpp
> >     cfe/trunk/test/Driver/fsanitize.c
> >
> > Modified: cfe/trunk/lib/Driver/Tools.cpp
> > URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Tools.cpp?rev=177061&r1=177060&r2=177061&view=diff
> >
> ==============================================================================
> > --- cfe/trunk/lib/Driver/Tools.cpp (original)
> > +++ cfe/trunk/lib/Driver/Tools.cpp Thu Mar 14 07:13:27 2013
> > @@ -1483,6 +1483,8 @@ SanitizerArgs::SanitizerArgs(const Drive
> >        AsanZeroBaseShadow(false) {
> >    unsigned AllKinds = 0;  // All kinds of sanitizers that were turned on
> >                            // at least once (possibly, disabled further).
> > +  unsigned AllRemovedKinds = 0;  // All kinds of sanitizers that were
> explicitly
> > +                                 // removed at least once.
> >    for (ArgList::const_iterator I = Args.begin(), E = Args.end(); I !=
> E; ++I) {
> >      unsigned Add, Remove;
> >      if (!parse(D, Args, *I, Add, Remove, true))
> > @@ -1491,6 +1493,12 @@ SanitizerArgs::SanitizerArgs(const Drive
> >      Kind |= Add;
> >      Kind &= ~Remove;
> >      AllKinds |= Add;
> > +    AllRemovedKinds |= Remove;
> > +  }
> > +  // Assume -fsanitize=address implies -fsanitize=init-order, if the
> latter is
> > +  // not disabled explicitly.
> > +  if ((Kind & Address) != 0 && (AllRemovedKinds & InitOrder) == 0) {
> > +    Kind |= InitOrder;
> >    }
> >
> >    UbsanTrapOnError =
> >
> > Modified: cfe/trunk/test/Driver/fsanitize.c
> > URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/fsanitize.c?rev=177061&r1=177060&r2=177061&view=diff
> >
> ==============================================================================
> > --- cfe/trunk/test/Driver/fsanitize.c (original)
> > +++ cfe/trunk/test/Driver/fsanitize.c Thu Mar 14 07:13:27 2013
> > @@ -16,6 +16,12 @@
> >  // RUN: %clang -target x86_64-linux-gnu -fsanitize=address-full %s -###
> 2>&1 | FileCheck %s --check-prefix=CHECK-ASAN-FULL
> >  // CHECK-ASAN-FULL:
> "-fsanitize={{((address|init-order|use-after-return|use-after-scope),?){4}"}}
> >
> > +// RUN: %clang -target x86_64-linux-gnu -fsanitize=address %s -### 2>&1
> |  FileCheck %s --check-prefix=CHECK-ASAN-IMPLIED-INIT-ORDER
> > +// CHECK-ASAN-IMPLIED-INIT-ORDER:
> "-fsanitize={{((address|init-order),?){2}"}}
> > +
> > +// RUN: %clang -target x86_64-linux-gnu -fsanitize=address
> -fno-sanitize=init-order %s -### 2>&1 |  FileCheck %s
> --check-prefix=CHECK-ASAN-NO-IMPLIED-INIT-ORDER
> > +// CHECK-ASAN-NO-IMPLIED-INIT-ORDER-NOT: init-order
> > +
> >  // RUN: %clang -target x86_64-linux-gnu -fcatch-undefined-behavior
> -fno-sanitize-undefined-trap-on-error %s -### 2>&1 | FileCheck %s
> --check-prefix=CHECK-UNDEFINED-NO-TRAP-ERROR
> >  // CHECK-UNDEFINED-NO-TRAP-ERROR: '-fcatch-undefined-behavior' not
> allowed with '-fno-sanitize-undefined-trap-on-error'
> >
> >
> >
> > _______________________________________________
> > cfe-commits mailing list
> > cfe-commits at cs.uiuc.edu
> > http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
>



-- 
Alexey Samsonov, MSK
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20130315/ba9dc4f4/attachment.html>


More information about the cfe-commits mailing list