+2016-08-15 Richard Biener <rguenther@suse.de>
+
+ PR tree-optimization/73434
+ * tree-ssa-sccvn.c (vn_reference_maybe_forwprop_address): Preserve
+ TBAA info on the base when forwarding a non-invariant address.
+
2016-08-15 Jakub Jelinek <jakub@redhat.com>
* dwarf2out.c (struct checksum_attributes): Add
+2016-08-15 Richard Biener <rguenther@suse.de>
+
+ PR tree-optimization/73434
+ * gcc.dg/torture/pr73434.c: New testcase.
+
2016-08-15 Jakub Jelinek <jakub@redhat.com>
PR tree-optimization/72824
--- /dev/null
+/* { dg-do run } */
+
+typedef struct { unsigned char x; } A;
+typedef struct { unsigned char x; } B;
+
+int idx = 0;
+
+A objs[1] = {{0}};
+
+int main()
+{
+ B *b = (B*)&objs[idx];
+ b->x++;
+ if (b->x)
+ b->x = 0;
+ if (b->x)
+ __builtin_abort ();
+ return 0;
+}
{
auto_vec<vn_reference_op_s, 32> tem;
copy_reference_ops_from_ref (TREE_OPERAND (addr, 0), &tem);
+ /* Make sure to preserve TBAA info. The only objects not
+ wrapped in MEM_REFs that can have their address taken are
+ STRING_CSTs. */
+ if (tem.length () >= 2
+ && tem[tem.length () - 2].opcode == MEM_REF)
+ {
+ vn_reference_op_t new_mem_op = &tem[tem.length () - 2];
+ new_mem_op->op0 = fold_convert (TREE_TYPE (mem_op->op0),
+ new_mem_op->op0);
+ }
+ else
+ gcc_assert (tem.last ().opcode == STRING_CST);
ops->pop ();
ops->pop ();
ops->safe_splice (tem);