PR tree-optimization/40432
* tree-sra.c (sra_modify_assign): When creating VIEW_CONVERT_EXPR,
check whether we need to force gimple register operand.
* testsuite/gcc.c-torture/compile/pr40432.c: New file.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@148522
138bc75d-0d04-0410-961f-
82ee72b054a4
2009-06-16 Martin Jambor <mjambor@suse.cz>
+ PR tree-optimization/40432
+ * tree-sra.c (sra_modify_assign): When creating VIEW_CONVERT_EXPR,
+ check whether we need to force gimple register operand.
+
+2009-06-16 Martin Jambor <mjambor@suse.cz>
+
PR tree-optimization/40413
* tree-sra.c (load_assign_lhs_subreplacements): Pass offset to
build_ref_for_offset.
2009-06-16 Martin Jambor <mjambor@suse.cz>
+ * testsuite/gcc.c-torture/compile/pr40432.c: New file.
+
+2009-06-16 Martin Jambor <mjambor@suse.cz>
+
* testsuite/gfortran.fortran-torture/compile/pr40413.f90: New file.
2009-06-16 Janus Weil <janus@gcc.gnu.org>
--- /dev/null
+/* Test that SRA produces valid gimple when handling both type punning by means
+ of VCE and creating an access to a union. */
+
+union U {
+ struct something *sth;
+ void *nothing;
+};
+
+void
+foo (union U *target, void *p)
+{
+ union U u;
+
+ u.nothing = p;
+ *target = u;
+ return;
+}
rhs = expr;
}
if (!useless_type_conversion_p (TREE_TYPE (lhs), TREE_TYPE (rhs)))
- rhs = fold_build1 (VIEW_CONVERT_EXPR, TREE_TYPE (lhs), rhs);
+ {
+ rhs = fold_build1 (VIEW_CONVERT_EXPR, TREE_TYPE (lhs), rhs);
+ if (!is_gimple_reg (lhs))
+ force_gimple_rhs = true;
+ }
}
if (force_gimple_rhs)