public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH][4.1] Fix PR28116, missed addressable var during inlining
@ 2007-01-05 13:52 Richard Guenther
  0 siblings, 0 replies; only message in thread
From: Richard Guenther @ 2007-01-05 13:52 UTC (permalink / raw)
  To: gcc-patches

[-- Attachment #1: Type: text/plain, Size: 453 bytes --]

This fixes PR28116 an ICE on building some KDE application.

Bootstrapped and tested on {i686,x86_64}-unknown-linux-gnu.  The patch
was overlooked by Honza.

Applied to the 4.1 branch (and the testcase to 4.2 and trunk as well).

Richard.

2007-01-05  Richard Guenther  <rguenther@suse.de>

        PR middle-end/28116
        * tree-inline.c (copy_body_r): Mark argument of ADDR_EXPR
        addressable.

        * g++.dg/opt/pr28116.C: New testcase.

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: fix-pr28116.diff --]
[-- Type: text/x-patch; name="fix-pr28116.diff", Size: 1537 bytes --]

2007-01-05  Richard Guenther  <rguenther@suse.de>

	PR middle-end/28116
	* tree-inline.c (copy_body_r): Mark argument of ADDR_EXPR
	addressable.

	* g++.dg/opt/pr28116.C: New testcase.

Index: tree-inline.c
===================================================================
*** tree-inline.c	(revision 120472)
--- tree-inline.c	(working copy)
*************** copy_body_r (tree *tp, int *walk_subtree
*** 714,720 ****
  	  if (TREE_CODE (TREE_OPERAND (*tp, 0)) == INDIRECT_REF)
  	    *tp = TREE_OPERAND (TREE_OPERAND (*tp, 0), 0);
  	  else
! 	    recompute_tree_invarant_for_addr_expr (*tp);
  	  *walk_subtrees = 0;
  	}
      }
--- 714,724 ----
  	  if (TREE_CODE (TREE_OPERAND (*tp, 0)) == INDIRECT_REF)
  	    *tp = TREE_OPERAND (TREE_OPERAND (*tp, 0), 0);
  	  else
! 	    {
! 	      recompute_tree_invarant_for_addr_expr (*tp);
! 	      if (DECL_P (TREE_OPERAND (*tp, 0)))
! 	        TREE_ADDRESSABLE (TREE_OPERAND (*tp, 0)) = 1;
! 	    }
  	  *walk_subtrees = 0;
  	}
      }
Index: testsuite/g++.dg/opt/pr28116.C
===================================================================
*** testsuite/g++.dg/opt/pr28116.C	(revision 0)
--- testsuite/g++.dg/opt/pr28116.C	(revision 0)
***************
*** 0 ****
--- 1,19 ----
+ /* { dg-do compile } */
+ /* { dg-options "-O3" } */
+ 
+ struct QDateTime
+ {
+     QDateTime addSecs( int secs ) const;
+     int t;
+ };
+ QDateTime gridToDate(long x)
+ {
+   QDateTime date;
+   date = date.addSecs(1);
+   return date;
+ }
+ void whatsOnAt(long x, long y)
+ {
+   gridToDate(x);
+ }
+ 

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

only message in thread, other threads:[~2007-01-05 13:52 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-01-05 13:52 [PATCH][4.1] Fix PR28116, missed addressable var during inlining 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).