+2011-07-22 Richard Guenther <rguenther@suse.de>
+
+ PR tree-optimization/45819
+ * tree-ssa-forwprop.c (forward_propagate_addr_expr_1): Properly
+ preserve volatile and notrap flags.
+
2011-07-22 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
+2011-07-22 Richard Guenther <rguenther@suse.de>
+
+ PR tree-optimization/45819
+ * gcc.dg/pr45819.c: New testcase.
+
2011-07-22 Uros Bizjak <ubizjak@gmail.com>
* lib/target-supports.exp (check_ifunc_available): Rewrite.
--- /dev/null
+/* { dg-do compile } */
+/* { dg-options "-O2 -fdump-tree-optimized" } */
+
+struct ehci_regs {
+ char x;
+ unsigned int port_status[0];
+} __attribute__ ((packed));
+
+struct ehci_hcd {
+ struct ehci_regs *regs;
+};
+
+int ehci_hub_control (struct ehci_hcd *ehci, int wIndex)
+{
+ unsigned int *status_reg = &ehci->regs->port_status[wIndex];
+ return *(volatile unsigned int *)status_reg;
+}
+
+/* { dg-final { scan-tree-dump "={v}" "optimized" } } */
+/* { dg-final { cleanup-tree-dump "optimized" } } */
}
*def_rhs_basep = build2 (MEM_REF, TREE_TYPE (*def_rhs_basep),
new_base, new_offset);
+ TREE_THIS_VOLATILE (*def_rhs_basep) = TREE_THIS_VOLATILE (lhs);
+ TREE_THIS_NOTRAP (*def_rhs_basep) = TREE_THIS_NOTRAP (lhs);
gimple_assign_set_lhs (use_stmt,
unshare_expr (TREE_OPERAND (def_rhs, 0)));
*def_rhs_basep = saved;
tidy_after_forward_propagate_addr (use_stmt);
return res;
}
- /* If the LHS is a plain dereference and the value type is the same as
+ /* If the RHS is a plain dereference and the value type is the same as
that of the pointed-to type of the address we can put the
- dereferenced address on the LHS preserving the original alias-type. */
+ dereferenced address on the RHS preserving the original alias-type. */
else if (gimple_assign_rhs1 (use_stmt) == rhs
&& useless_type_conversion_p
(TREE_TYPE (gimple_assign_lhs (use_stmt)),
}
*def_rhs_basep = build2 (MEM_REF, TREE_TYPE (*def_rhs_basep),
new_base, new_offset);
+ TREE_THIS_VOLATILE (*def_rhs_basep) = TREE_THIS_VOLATILE (rhs);
+ TREE_THIS_NOTRAP (*def_rhs_basep) = TREE_THIS_NOTRAP (rhs);
gimple_assign_set_rhs1 (use_stmt,
unshare_expr (TREE_OPERAND (def_rhs, 0)));
*def_rhs_basep = saved;