[PATCH] Fix PR69715
Richard Biener
rguenther@suse.de
Tue Feb 9 08:33:00 GMT 2016
The following fixes update-address-taken to properly reject rewriting
decls into SSA that require fixup of call lhs because that's not done.
Bootstrapped and tested on x86_64-unknown-linux-gnu, applied.
Richard.
2016-02-09 Richard Biener <rguenther@suse.de>
PR tree-optimization/69715
* tree-ssa.c (execute_update_addresses_taken): Mark non-decl
LHS on calls as non-rewritable.
* gcc.dg/torture/pr69715.c: New testcase.
Index: gcc/tree-ssa.c
===================================================================
*** gcc/tree-ssa.c (revision 233211)
--- gcc/tree-ssa.c (working copy)
*************** execute_update_addresses_taken (void)
*** 1436,1442 ****
tree lhs = gimple_get_lhs (stmt);
if (lhs
&& TREE_CODE (lhs) != SSA_NAME
! && non_rewritable_lvalue_p (lhs))
{
decl = get_base_address (lhs);
if (DECL_P (decl))
--- 1443,1450 ----
tree lhs = gimple_get_lhs (stmt);
if (lhs
&& TREE_CODE (lhs) != SSA_NAME
! && ((code == GIMPLE_CALL && ! DECL_P (lhs))
! || non_rewritable_lvalue_p (lhs)))
{
decl = get_base_address (lhs);
if (DECL_P (decl))
Index: gcc/testsuite/gcc.dg/torture/pr69715.c
===================================================================
*** gcc/testsuite/gcc.dg/torture/pr69715.c (revision 0)
--- gcc/testsuite/gcc.dg/torture/pr69715.c (working copy)
***************
*** 0 ****
--- 1,11 ----
+ /* { dg-do compile } */
+
+ struct __attribute__((may_alias)) S { long long low; int high; };
+ struct S foo (void);
+ long double
+ bar (void)
+ {
+ long double a;
+ *(struct S *)&a = foo ();
+ return a;
+ }
More information about the Gcc-patches
mailing list