re PR c++/62017 (AddressSanitizer reports *-buffer-overflow in destructor when multip...
authorJakub Jelinek <jakub@redhat.com>
Thu, 18 Sep 2014 14:08:28 +0000 (16:08 +0200)
committerJakub Jelinek <jakub@gcc.gnu.org>
Thu, 18 Sep 2014 14:08:28 +0000 (16:08 +0200)
PR c++/62017
* asan.c (transform_statements): Don't instrument clobber statements.

* g++.dg/asan/pr62017.C: New test.

From-SVN: r215354

gcc/ChangeLog
gcc/asan.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/asan/pr62017.C [new file with mode: 0644]

index 5d859468d6535f88a94f9a0ef0c8c095102fe498..a8dc34e04b77ed0f119cb16f580121f80b85d8b5 100644 (file)
@@ -1,3 +1,8 @@
+2014-09-18  Jakub Jelinek  <jakub@redhat.com>
+
+       PR c++/62017
+       * asan.c (transform_statements): Don't instrument clobber statements.
+
 2014-09-18  Kyrylo Tkachov  <kyrylo.tkachov@arm.com>
 
        * config/arm/neon.md (*movmisalign<mode>_neon_load): Change type
index cf5de275e13b64f26e2e9574208702a4e28ad17d..6ff85bbf8dd0e5e79113471c07e6d764455c1d75 100644 (file)
@@ -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.  */;
index 2a68dbf19a45846211adf2b1e813215f8aa564b9..9d42700761ca9ece3ffba5cec05ceb61aef50fe4 100644 (file)
@@ -1,5 +1,8 @@
 2014-09-18  Jakub Jelinek  <jakub@redhat.com>
 
+       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 (file)
index 0000000..74ef37f
--- /dev/null
@@ -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;
+}