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
--- /dev/null
+// 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;
+}
--- /dev/null
+/* 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;
+}