[PATCH] D24323: [asan] Test that asan does not report use-after-scope if program jumped over variable declaration.
Vitaly Buka via llvm-commits
llvm-commits at lists.llvm.org
Wed Sep 7 16:25:57 PDT 2016
vitalybuka created this revision.
vitalybuka added a reviewer: eugenis.
vitalybuka added a subscriber: llvm-commits.
Herald added a subscriber: kubabrecka.
Test to check if PR28267 workaround works.
PR28267
PR27453
https://reviews.llvm.org/D24323
Files:
test/asan/TestCases/use-after-scope-goto.c
Index: test/asan/TestCases/use-after-scope-goto.c
===================================================================
--- /dev/null
+++ test/asan/TestCases/use-after-scope-goto.c
@@ -0,0 +1,21 @@
+// RUN: %clang_asan -O0 -fsanitize-address-use-after-scope %s -o %t && %run %t
+
+// Function jumps over variable initialization making lifetime analysis
+// ambiguous. Asan should ignore such variable and program must not fail.
+
+int *ptr;
+
+void f(int cond) {
+ if (cond)
+ goto label;
+ int tmp = 1;
+
+label:
+ ptr = &tmp;
+ *ptr = 5;
+}
+
+int main() {
+ f(1);
+ return 0;
+}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D24323.70617.patch
Type: text/x-patch
Size: 589 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160907/dd34bd96/attachment.bin>
More information about the llvm-commits
mailing list