[PATCH] Enable -fsanitize=use-after-return by default under -fsanitize=address
Kostya Serebryany
kcc at google.com
Mon Sep 23 02:49:49 PDT 2013
fixed/extended the test.
Hi samsonov,
http://llvm-reviews.chandlerc.com/D1741
CHANGE SINCE LAST DIFF
http://llvm-reviews.chandlerc.com/D1741?vs=4441&id=4442#toc
BRANCH
svn
ARCANIST PROJECT
clang
Files:
test/Driver/fsanitize.c
lib/Driver/SanitizerArgs.cpp
Index: test/Driver/fsanitize.c
===================================================================
--- test/Driver/fsanitize.c
+++ test/Driver/fsanitize.c
@@ -16,12 +16,15 @@
// 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 -fno-sanitize=init-order -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 -fno-sanitize=init-order,use-after-return -fsanitize=address %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-ASAN-IMPLIED-INIT-ORDER-UAR
+// CHECK-ASAN-IMPLIED-INIT-ORDER-UAR: "-fsanitize={{((address|init-order|use-after-return),?){3}"}}
// 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 -fsanitize=address -fno-sanitize=use-after-return %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-ASAN-NO-IMPLIED-UAR
+// CHECK-ASAN-NO-IMPLIED-UAR-NOT: use-after-return
+
// 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'
Index: lib/Driver/SanitizerArgs.cpp
===================================================================
--- lib/Driver/SanitizerArgs.cpp
+++ lib/Driver/SanitizerArgs.cpp
@@ -211,11 +211,11 @@
#define SANITIZER_GROUP(NAME, ID, ALIAS) .Case(NAME, ID)
#include "clang/Basic/Sanitizers.def"
.Default(SanitizeKind());
- // Assume -fsanitize=address implies -fsanitize=init-order.
+ // Assume -fsanitize=address implies -fsanitize=init-order,use-after-return.
// FIXME: This should be either specified in Sanitizers.def, or go away when
- // we get rid of "-fsanitize=init-order" flag at all.
+ // we get rid of "-fsanitize=init-order,use-after-return" flags at all.
if (ParsedKind & Address)
- ParsedKind |= InitOrder;
+ ParsedKind |= InitOrder | UseAfterReturn;
return ParsedKind;
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D1741.2.patch
Type: text/x-patch
Size: 2464 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20130923/88a62f80/attachment.bin>
More information about the llvm-commits
mailing list