2005-03-16 Daniel Berlin <dberlin@dberlin.org>
+
+ Fix PR tree-optimization/20489
+
+ * tree-ssa-alias.c (push_fields_onto_fieldstack): DTRT
+ for empty structures.
+
+2005-03-16 Daniel Berlin <dberlin@dberlin.org>
Fix PR tree-optimization/20490
--- /dev/null
+/* { dg-do compile } */
+/* { dg-options "-O2" } */
+
+struct A
+{
+ ~A();
+};
+
+/* If we don't create SFT's for the "empty" structure A, bad things
+ will happen, and we will fail verification. */
+struct B
+{
+ int i;
+ A a;
+
+ void foo() {}
+};
+
+void bar()
+{
+ B().foo();
+}
continue;
if (var_can_have_subvars (field))
{
+ size_t before = VEC_length (fieldoff_t, *fieldstack);
push_fields_onto_fieldstack (TREE_TYPE (field), fieldstack,
offset + bitpos_of_field (field));
+ /* Empty structures may have actual size, like in C++. So see if we
+ actually end up pushing a field, and if not, if the size is non-zero,
+ push the field onto the stack */
+ if (before == VEC_length (fieldoff_t, *fieldstack)
+ && DECL_SIZE (field)
+ && !integer_zerop (DECL_SIZE (field)))
+ {
+ pair = xmalloc (sizeof (struct fieldoff));
+ pair->field = field;
+ pair->offset = offset + bitpos_of_field (field);
+ VEC_safe_push (fieldoff_t, *fieldstack, pair);
+ }
}
else
{