Commit 52e67970 by Jakub Jelinek Committed by Jakub Jelinek

re PR sanitizer/88901 (ICE when using -fsanitize=pointer-compare)

	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
parent 3b1f091c
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> 2019-01-18 Jason Merrill <jason@redhat.com>
PR c++/88875 - error with explicit list constructor. PR c++/88875 - error with explicit list constructor.
......
...@@ -5233,6 +5233,7 @@ cp_build_binary_op (const op_location_t &location, ...@@ -5233,6 +5233,7 @@ cp_build_binary_op (const op_location_t &location,
} }
if ((code0 == POINTER_TYPE || code1 == POINTER_TYPE) if ((code0 == POINTER_TYPE || code1 == POINTER_TYPE)
&& !processing_template_decl
&& sanitize_flags_p (SANITIZE_POINTER_COMPARE)) && sanitize_flags_p (SANITIZE_POINTER_COMPARE))
{ {
op0 = save_expr (op0); op0 = save_expr (op0);
...@@ -5650,7 +5651,8 @@ pointer_diff (location_t loc, tree op0, tree op1, tree ptrtype, ...@@ -5650,7 +5651,8 @@ pointer_diff (location_t loc, tree op0, tree op1, tree ptrtype,
else else
inttype = restype; inttype = restype;
if (sanitize_flags_p (SANITIZE_POINTER_SUBTRACT)) if (!processing_template_decl
&& sanitize_flags_p (SANITIZE_POINTER_SUBTRACT))
{ {
op0 = save_expr (op0); op0 = save_expr (op0);
op1 = save_expr (op1); 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> 2019-01-21 Tamar Christina <tamar.christina@arm.com>
* g++.dg/vect/simd-clone-7.cc: Fix assembler scan. * g++.dg/vect/simd-clone-7.cc: Fix assembler scan.
......
// 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();
};
}
};
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment