[PATCH] D34827: Add end-to-end tests for overflows of byval arguments.

Evgenii Stepanov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jun 29 12:26:40 PDT 2017


eugenis added inline comments.


================
Comment at: test/asan/TestCases/pass-struct-byval.cc:1
+// RUN: %clangxx_asan -O0 %s -o %t
+// RUN: not %run %t 2>&1 | FileCheck %s
----------------
vitalybuka wrote:
> what is going to happen with -O1?
The code in bar() will be optimized to undef, I think. 
"int * volatile ptr" should protect against that.


================
Comment at: test/asan/TestCases/pass-struct-byval.cc:10
+  int *ptr = &a->a[0];
+  return *((int *) (ptr - 1));
+}
----------------
(int *) cast seems unnecessary. (ptr - 1) is already that.



https://reviews.llvm.org/D34827





More information about the llvm-commits mailing list