From e1e160c11fcc059556449e5440d99b904b9a9e6f Mon Sep 17 00:00:00 2001 From: Jakub Jelinek Date: Thu, 18 Sep 2014 16:08:28 +0200 Subject: [PATCH] re PR c++/62017 (AddressSanitizer reports *-buffer-overflow in destructor when multiple virtual inheritance is used) PR c++/62017 * asan.c (transform_statements): Don't instrument clobber statements. * g++.dg/asan/pr62017.C: New test. From-SVN: r215354 --- gcc/ChangeLog | 5 +++++ gcc/asan.c | 1 + gcc/testsuite/ChangeLog | 3 +++ gcc/testsuite/g++.dg/asan/pr62017.C | 17 +++++++++++++++++ 4 files changed, 26 insertions(+) create mode 100644 gcc/testsuite/g++.dg/asan/pr62017.C diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 5d859468d65..a8dc34e04b7 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +2014-09-18 Jakub Jelinek + + PR c++/62017 + * asan.c (transform_statements): Don't instrument clobber statements. + 2014-09-18 Kyrylo Tkachov * config/arm/neon.md (*movmisalign_neon_load): Change type diff --git a/gcc/asan.c b/gcc/asan.c index cf5de275e13..6ff85bbf8dd 100644 --- a/gcc/asan.c +++ b/gcc/asan.c @@ -2072,6 +2072,7 @@ transform_statements (void) if (has_stmt_been_instrumented_p (s)) gsi_next (&i); else if (gimple_assign_single_p (s) + && !gimple_clobber_p (s) && maybe_instrument_assignment (&i)) /* Nothing to do as maybe_instrument_assignment advanced the iterator I. */; diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 2a68dbf19a4..9d42700761c 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,5 +1,8 @@ 2014-09-18 Jakub Jelinek + PR c++/62017 + * g++.dg/asan/pr62017.C: New test. + PR testsuite/63292 * gcc.dg/vect/pr59594.c (b): Increase size to N + 2 elements. diff --git a/gcc/testsuite/g++.dg/asan/pr62017.C b/gcc/testsuite/g++.dg/asan/pr62017.C new file mode 100644 index 00000000000..74ef37fd2c0 --- /dev/null +++ b/gcc/testsuite/g++.dg/asan/pr62017.C @@ -0,0 +1,17 @@ +// PR c++/62017 +// { dg-do run } + +struct A +{ + int x; + virtual ~A () {} +}; +struct B : public virtual A {}; +struct C : public virtual A {}; +struct D : public B, virtual public C {}; + +int +main () +{ + D d; +} -- 2.30.2