public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH] Fix PR34127
@ 2007-11-18 18:56 Richard Guenther
  0 siblings, 0 replies; only message in thread
From: Richard Guenther @ 2007-11-18 18:56 UTC (permalink / raw)
  To: gcc-patches


This fixes PR34127, another fallout from the forwprop change.  This
will actually be the last try before I consider reverting to the original
state ;)

Bootstrapped and tested on x86_64-unknown-linux-gnu, applied to trunk.

Richard.

2007-11-18  Richard Guenther  <rguenther@suse.de>

	PR tree-optimization/34127
	* tree-ssa-forwprop.c (tree_ssa_forward_propagate_single_use_vars):
	Make code match up the comments, require compatibility of the
	pointed-to types.

	* gcc.c-torture/compile/pr34127.c: New testcase.

Index: tree-ssa-forwprop.c
===================================================================
*** tree-ssa-forwprop.c	(revision 130257)
--- tree-ssa-forwprop.c	(working copy)
*************** tree_ssa_forward_propagate_single_use_va
*** 959,966 ****
  		       || TREE_CODE (rhs) == CONVERT_EXPR)
  		      && TREE_CODE (TREE_OPERAND (rhs, 0)) == ADDR_EXPR
  		      && POINTER_TYPE_P (TREE_TYPE (rhs))
! 		      && useless_type_conversion_p (TREE_TYPE (TREE_TYPE (TREE_OPERAND (rhs, 0))),
! 						    TREE_TYPE (TREE_TYPE (rhs)))))
  		{
  		  if (forward_propagate_addr_expr (lhs, rhs))
  		    {
--- 959,966 ----
  		       || TREE_CODE (rhs) == CONVERT_EXPR)
  		      && TREE_CODE (TREE_OPERAND (rhs, 0)) == ADDR_EXPR
  		      && POINTER_TYPE_P (TREE_TYPE (rhs))
! 		      && types_compatible_p (TREE_TYPE (TREE_TYPE (TREE_OPERAND (rhs, 0))),
! 					     TREE_TYPE (TREE_TYPE (rhs)))))
  		{
  		  if (forward_propagate_addr_expr (lhs, rhs))
  		    {
Index: testsuite/gcc.c-torture/compile/pr34127.c
===================================================================
*** testsuite/gcc.c-torture/compile/pr34127.c	(revision 0)
--- testsuite/gcc.c-torture/compile/pr34127.c	(revision 0)
***************
*** 0 ****
--- 1,9 ----
+ static void 
+ whichtable(char **pfmt)
+ {
+   --*pfmt;
+ }
+ void prepare_s(const char *fmt)
+ {
+   whichtable((char **)&fmt);
+ }

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

only message in thread, other threads:[~2007-11-18 15:46 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-11-18 18:56 [PATCH] Fix PR34127 Richard Guenther

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).