[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 23:51:39 PDT 2016
This revision was automatically updated to reflect the committed changes.
Closed by commit rL280908: [asan] Test that asan does not report use-after-scope if program jumped over… (authored by vitalybuka).
Changed prior to commit:
https://reviews.llvm.org/D24323?vs=70617&id=70651#toc
Repository:
rL LLVM
https://reviews.llvm.org/D24323
Files:
compiler-rt/trunk/test/asan/TestCases/use-after-scope-goto.c
Index: compiler-rt/trunk/test/asan/TestCases/use-after-scope-goto.c
===================================================================
--- compiler-rt/trunk/test/asan/TestCases/use-after-scope-goto.c
+++ compiler-rt/trunk/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.70651.patch
Type: text/x-patch
Size: 676 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160908/f0964732/attachment.bin>
More information about the llvm-commits
mailing list