+2012-01-09 Martin Jambor <mjambor@suse.cz>
+
+ PR tree-optimization/51759
+ Backport from mainline
+ 2010-09-15 Martin Jambor <mjambor@suse.cz>
+
+ PR middle-end/45644
+ * tree-sra.c (create_access): Check for bit-fields directly.
+
2012-01-09 Eric Botcazou <ebotcazou@adacore.com>
* config/sparc/sol2-unwind.h (sparc64_is_sighandler): Check that the
+2012-01-09 Martin Jambor <mjambor@suse.cz>
+
+ PR tree-optimization/51759
+ * gcc.dg/ipa/pr45644.c: New test.
+ * g++.dg/ipa/pr51759.C: Likewise.
+
2012-01-06 Richard Sandiford <richard.sandiford@linaro.org>
PR middle-end/48660
--- /dev/null
+/* { dg-do run } */
+/* { dg-options "-O2" } */
+
+extern "C" void abort (void);
+struct S
+{
+ void __attribute__((noinline)) set(unsigned val)
+ {
+ data = val;
+ if (data != val)
+ abort ();
+ }
+ int pad0;
+ unsigned pad1 : 8;
+ unsigned data : 24;
+ int pad2;
+};
+int main()
+{
+ S s;
+ s.pad2 = -1;
+ s.set(0);
+ if (s.pad2 != -1)
+ abort ();
+}
+
--- /dev/null
+/* Verify that we do not IPA-SRA bitfields. */
+/* { dg-do run } */
+/* { dg-options "-O2" } */
+
+extern void abort (void);
+
+struct S
+{
+ int j : 8;
+ int i : 24;
+ int l;
+};
+
+static int __attribute__((noinline)) foo (struct S *s)
+{
+ int z = s->i;
+ if (z != 777)
+ abort ();
+ return 0;
+}
+
+int __attribute__((noinline)) bar (struct S *s)
+{
+ return foo (s);
+}
+
+int main (int argc, char *argv[])
+{
+ struct S s;
+ s.j = 5;
+ s.i = 777;
+ s.l = -1;
+
+ return bar (&s);
+}
disqualify_candidate (base, "Encountered a variable sized access.");
return NULL;
}
- if ((offset % BITS_PER_UNIT) != 0 || (size % BITS_PER_UNIT) != 0)
+ if (TREE_CODE (expr) == COMPONENT_REF
+ && DECL_BIT_FIELD (TREE_OPERAND (expr, 1)))
{
- disqualify_candidate (base,
- "Encountered an acces not aligned to a byte.");
+ disqualify_candidate (base, "Encountered a bit-field access.");
return NULL;
}
+ gcc_assert ((offset % BITS_PER_UNIT) == 0);
if (ptr)
mark_parm_dereference (base, offset + size, stmt);