]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
backport: [multiple changes]
authorRichard Biener <rguenth@gcc.gnu.org>
Mon, 18 Apr 2011 14:37:08 +0000 (14:37 +0000)
committerRichard Biener <rguenth@gcc.gnu.org>
Mon, 18 Apr 2011 14:37:08 +0000 (14:37 +0000)
2011-04-18  Richard Guenther  <rguenther@suse.de>

    Backported from 4.6 branch
    2011-03-11  Jakub Jelinek  <jakub@redhat.com>

    PR c++/48035
    * init.c (build_zero_init_1): Extracted from build_zero_init.
    Add FIELD_SIZE argument, if non-NULL and field bit_position
    as not smaller than that, don't add that field's initializer.
    Pass DECL_SIZE as last argument to build_zero_init_1
    for DECL_FIELD_IS_BASE fields.
    (build_zero_init): Use build_zero_init_1.

    * g++.dg/inherit/virtual8.C: New test.

    2011-03-05  Zdenek Dvorak  <ook@ucw.cz>

    PR rtl-optimization/47899
    * cfgloopmanip.c (fix_bb_placements): Fix first argument
    to flow_loop_nested_p when moving the loop upward.

    * gcc.dg/pr47899.c: New test.

    2011-03-15  Richard Guenther  <rguenther@suse.de>

    PR middle-end/48031
    * fold-const.c (fold_indirect_ref_1): Do not create new variable-sized
    or variable-indexed array accesses when in gimple form.

From-SVN: r172652

gcc/testsuite/g++.dg/inherit/virtual8.C [new file with mode: 0644]
gcc/testsuite/gcc.dg/pr47899.c [new file with mode: 0644]

diff --git a/gcc/testsuite/g++.dg/inherit/virtual8.C b/gcc/testsuite/g++.dg/inherit/virtual8.C
new file mode 100644 (file)
index 0000000..4f6a119
--- /dev/null
@@ -0,0 +1,48 @@
+// PR c++/48035
+// { dg-do run }
+
+#include <new>
+#include <cstring>
+#include <cstdlib>
+
+struct A
+{
+  virtual void foo (void) {}
+  virtual ~A () {}
+};
+
+struct B : public A
+{
+  virtual ~B () {}
+};
+
+struct C
+{
+  virtual ~C () {}
+  int c;
+};
+
+struct D : public virtual B, public C
+{
+  virtual ~D () {}
+};
+
+struct E : public virtual D
+{
+  virtual ~E () {}
+};
+
+int
+main ()
+{
+  char *v = new char[sizeof (E) + 16];
+  memset (v, 0x55, sizeof (E) + 16);
+  E *e = new (v) E ();
+  e->~E ();
+
+  for (unsigned i = sizeof (E); i < sizeof (E) + 16; ++i)
+    if (v[i] != 0x55)
+      abort ();
+
+  delete[] v;
+}
diff --git a/gcc/testsuite/gcc.dg/pr47899.c b/gcc/testsuite/gcc.dg/pr47899.c
new file mode 100644 (file)
index 0000000..c83bb85
--- /dev/null
@@ -0,0 +1,26 @@
+/* PR rtl-optimization/47899 */
+/* { dg-do compile } */
+/* { dg-options "-O -funroll-loops" } */
+
+extern unsigned int a, b, c;
+extern int d;
+
+static int
+foo (void)
+{
+lab:
+  if (b)
+    for (d = 0; d >= 0; d--)
+      if (a || c)
+       for (; c; c++)
+         ;
+      else
+       goto lab;
+}
+
+int
+main ()
+{
+  foo ();
+  return 0;
+}