PR sanitizer/88901
* typeck.c (cp_build_binary_op): Don't instrument
SANITIZE_POINTER_COMPARE if processing_template_decl.
(pointer_diff): Similarly for SANITIZE_POINTER_SUBTRACT.
* g++.dg/asan/pr88901.C: New test.
From-SVN: r268122
+2019-01-21 Jakub Jelinek <jakub@redhat.com>
+
+ PR sanitizer/88901
+ * typeck.c (cp_build_binary_op): Don't instrument
+ SANITIZE_POINTER_COMPARE if processing_template_decl.
+ (pointer_diff): Similarly for SANITIZE_POINTER_SUBTRACT.
+
2019-01-18 Jason Merrill <jason@redhat.com>
PR c++/88875 - error with explicit list constructor.
}
if ((code0 == POINTER_TYPE || code1 == POINTER_TYPE)
+ && !processing_template_decl
&& sanitize_flags_p (SANITIZE_POINTER_COMPARE))
{
op0 = save_expr (op0);
else
inttype = restype;
- if (sanitize_flags_p (SANITIZE_POINTER_SUBTRACT))
+ if (!processing_template_decl
+ && sanitize_flags_p (SANITIZE_POINTER_SUBTRACT))
{
op0 = save_expr (op0);
op1 = save_expr (op1);
+2019-01-21 Jakub Jelinek <jakub@redhat.com>
+
+ PR sanitizer/88901
+ * g++.dg/asan/pr88901.C: New test.
+
2019-01-21 Tamar Christina <tamar.christina@arm.com>
* g++.dg/vect/simd-clone-7.cc: Fix assembler scan.
--- /dev/null
+// PR sanitizer/88901
+// { dg-do compile }
+// { dg-options "-fsanitize=address -fsanitize=pointer-compare" }
+
+template <typename T>
+struct A {
+ void foo() {
+ auto d = [](char *x, char *y) {
+ for (char *p = x; p + sizeof(T) <= y; p += sizeof(T))
+ reinterpret_cast<T *>(p)->~T();
+ };
+ }
+};