+2012-09-25 Richard Guenther <rguenther@suse.de>
+
+ PR tree-optimization/53663
+ * tree-ssa-sccvn.c (vn_reference_lookup_3): Conditional
+ native encode/interpret translation on VN_WALKREWRITE.
+
2012-09-24 Dehao Chen <dehao@google.com>
* tree-cfg.c (move_stmt_op): Reset the expr block only
+2012-09-25 Richard Guenther <rguenther@suse.de>
+
+ PR tree-optimization/53663
+ * gcc.dg/torture/pr53663-1.c: New testcase.
+ * gcc.dg/torture/pr53663-2.c: Likewise.
+ * gcc.dg/torture/pr53663-3.c: Likewise.
+
2012-09-25 Uros Bizjak <ubizjak@gmail.com>
* gcc.target/i386/pr50725.c: Change 'long' to 'long long'.
--- /dev/null
+/* { dg-do run } */
+
+extern void abort (void);
+
+union u
+{
+ int i;
+ _Bool b;
+};
+
+void f(union u * vp, union u v)
+{
+ *vp = v;
+}
+
+int main()
+{
+ union u v;
+ union u v1;
+ union u v2;
+
+ v.i = 10;
+ f(&v1, v);
+
+ v.b = 0;
+ f(&v2, v);
+ if (v2.b != 0)
+ abort ();
+ return 0;
+}
--- /dev/null
+/* { dg-do run } */
+
+extern void abort (void);
+
+union u
+{
+ int i;
+ short f;
+} v;
+
+short foo (short *f)
+{
+ *f = 1;
+ v.i = 0;
+ v.f = 0;
+ return *f;
+}
+
+int main()
+{
+ if (foo (&v.f) != 0)
+ abort ();
+ return 0;
+}
--- /dev/null
+/* { dg-do run } */
+
+extern void abort (void);
+
+union u
+{
+ int i;
+ float f;
+} v;
+
+float foo (float *f)
+{
+ *f = 1;
+ v.i = 0;
+ v.f = 0.;
+ return *f;
+}
+
+int main()
+{
+ if (foo (&v.f) != 0.)
+ abort ();
+ return 0;
+}
/* 3) Assignment from a constant. We can use folds native encode/interpret
routines to extract the assigned bits. */
- else if (CHAR_BIT == 8 && BITS_PER_UNIT == 8
+ else if (vn_walk_kind == VN_WALKREWRITE
+ && CHAR_BIT == 8 && BITS_PER_UNIT == 8
&& ref->size == maxsize
&& maxsize % BITS_PER_UNIT == 0
&& offset % BITS_PER_UNIT == 0