re PR sanitizer/65019 (Compare debug failure with -fsanitize=alignment,object-size...
authorJakub Jelinek <jakub@redhat.com>
Thu, 12 Feb 2015 09:48:44 +0000 (10:48 +0100)
committerJakub Jelinek <jakub@gcc.gnu.org>
Thu, 12 Feb 2015 09:48:44 +0000 (10:48 +0100)
PR sanitizer/65019
* ubsan.c (ubsan_expand_objsize_ifn): Always return true.

* g++.dg/ubsan/pr65019.C: New test.

From-SVN: r220641

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

index 723c62e2d150a751f6e8a0610cab65a31f75bcee..60af263eebdf3c2296e7da55f122d567ed1404a8 100644 (file)
@@ -1,5 +1,8 @@
 2015-02-12  Jakub Jelinek  <jakub@redhat.com>
 
+       PR sanitizer/65019
+       * ubsan.c (ubsan_expand_objsize_ifn): Always return true.
+
        PR tree-optimization/65014
        * fold-const.c (fold_binary_loc): When creating {L,R}ROTATE_EXPR,
        use original second operand of arg0 or arg1 instead of
index dfd7230fda4849a7588ed2cb5d75b55808dccdc9..01127e953c59b22acc4cbd4015ab17cc36161928 100644 (file)
@@ -1,5 +1,8 @@
 2015-02-12  Jakub Jelinek  <jakub@redhat.com>
 
+       PR sanitizer/65019
+       * g++.dg/ubsan/pr65019.C: New test.
+
        PR tree-optimization/65014
        * gcc.c-torture/compile/pr65014.c: New test.
 
diff --git a/gcc/testsuite/g++.dg/ubsan/pr65019.C b/gcc/testsuite/g++.dg/ubsan/pr65019.C
new file mode 100644 (file)
index 0000000..a7f21a7
--- /dev/null
@@ -0,0 +1,24 @@
+// PR sanitizer/65019
+// { dg-do compile }
+// { dg-options "-fsanitize=alignment,object-size,vptr -std=c++11 -O2 -fcompare-debug" }
+
+struct A { };
+struct B { };
+struct C final {
+  C (const A &, int);
+  static B *foo (const A &, int = 1);
+  virtual ~C ();
+  void *c;
+};
+
+B *
+C::foo (const A &x, int y)
+{
+  C *d = new C (x, y);
+  if (d->c == nullptr)
+    delete d;
+}
+
+C::~C ()
+{
+}
index 2c1030c3169babfe7538cbb46f28fe6438288798..fc3352f99495eaf52353be33eead0320713e3bc0 100644 (file)
@@ -987,7 +987,7 @@ ubsan_expand_objsize_ifn (gimple_stmt_iterator *gsi)
   /* Get rid of the UBSAN_OBJECT_SIZE call from the IR.  */
   unlink_stmt_vdef (stmt);
   gsi_remove (&gsi_orig, true);
-  return gsi_end_p (*gsi);
+  return true;
 }
 
 /* Cached __ubsan_vptr_type_cache decl.  */