public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH] Fix PR69715
@ 2016-02-09  8:33 Richard Biener
  0 siblings, 0 replies; only message in thread
From: Richard Biener @ 2016-02-09  8:33 UTC (permalink / raw)
  To: gcc-patches


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;
+ }

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2016-02-09  8:33 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-02-09  8:33 [PATCH] Fix PR69715 Richard Biener

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).