This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] Fix PR45991


This fixes an oversight in my attempt to fix TMR base gimplification.

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

Richard.

2010-11-04  Richard Guenther  <rguenther@suse.de>

	PR tree-optimization/45991
	* gimplify.c (force_gimple_operand_1): Use the provded test
	function in the initial test.

	* gcc.dg/pr45991.c: New testcase.

Index: gcc/gimplify.c
===================================================================
*** gcc/gimplify.c	(revision 166304)
--- gcc/gimplify.c	(working copy)
*************** force_gimple_operand_1 (tree expr, gimpl
*** 8047,8053 ****
  
    *stmts = NULL;
  
!   if (is_gimple_val (expr))
      return expr;
  
    push_gimplify_context (&gctx);
--- 8047,8057 ----
  
    *stmts = NULL;
  
!   /* gimple_test_f might be more strict than is_gimple_val, make
!      sure we pass both.  Just checking gimple_test_f doesn't work
!      because most gimple predicates do not work recursively.  */
!   if (is_gimple_val (expr)
!       && (*gimple_test_f) (expr))
      return expr;
  
    push_gimplify_context (&gctx);
Index: gcc/testsuite/gcc.dg/pr45991.c
===================================================================
*** gcc/testsuite/gcc.dg/pr45991.c	(revision 0)
--- gcc/testsuite/gcc.dg/pr45991.c	(revision 0)
***************
*** 0 ****
--- 1,20 ----
+ /* { dg-do compile } */
+ /* { dg-options "-O -fstrict-overflow" } */
+ 
+ struct S
+ {
+   int i;
+ };
+ 
+ char A[64];
+ 
+ void foo (char **dst, int i)
+ {
+   char *p = A + 16;
+   while (i--)
+     {
+       int b = ((struct S *) (&p[i * 16 + 4]))->i;
+       char *c = A + i * 16;
+       dst[i] = c + b;
+     }
+ }


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]