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 CSiBE linux-kernel compile


This fixes another ICE of the form
internal compiler error: in gimple_rhs_has_side_effects, at gimple.c:2370
as it happens during compile of the CSiBE benchmark.  We were
changing flags of shared decl nodes which is not a good idea.

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

Richard.

2008-08-20  Richard Guenther  <rguenther@suse.de>

	* tree-ssa-ccp.c (maybe_fold_stmt_indirect): Do not mess
	with TREE_THIS_VOLATILE on shared nodes.
	(fold_stmt_r): Likewise.

	* gcc.c-torture/compile/20080820-1.c: New testcase.

Index: gcc/tree-ssa-ccp.c
===================================================================
*** gcc/tree-ssa-ccp.c	(revision 139287)
--- gcc/tree-ssa-ccp.c	(working copy)
*************** maybe_fold_stmt_indirect (tree expr, tre
*** 2118,2124 ****
  					  TREE_TYPE (expr));
        if (t)
  	{
! 	  TREE_THIS_VOLATILE (t) = volatile_p;
  	  return t;
  	}
      }
--- 2118,2128 ----
  					  TREE_TYPE (expr));
        if (t)
  	{
! 	  /* Preserve volatileness of the original expression.
! 	     We can end up with a plain decl here which is shared
! 	     and we shouldn't mess with its flags.  */
! 	  if (!SSA_VAR_P (t))
! 	    TREE_THIS_VOLATILE (t) = volatile_p;
  	  return t;
  	}
      }
*************** fold_stmt_r (tree *expr_p, int *walk_sub
*** 2404,2411 ****
  
    if (t)
      {
!       /* Preserve volatileness of the original expression.  */
!       TREE_THIS_VOLATILE (t) = volatile_p;
        *expr_p = t;
        *changed_p = true;
      }
--- 2408,2418 ----
  
    if (t)
      {
!       /* Preserve volatileness of the original expression.
! 	 We can end up with a plain decl here which is shared
! 	 and we shouldn't mess with its flags.  */
!       if (!SSA_VAR_P (t))
! 	TREE_THIS_VOLATILE (t) = volatile_p;
        *expr_p = t;
        *changed_p = true;
      }
Index: gcc/testsuite/gcc.c-torture/compile/20080820-1.c
===================================================================
*** gcc/testsuite/gcc.c-torture/compile/20080820-1.c	(revision 0)
--- gcc/testsuite/gcc.c-torture/compile/20080820-1.c	(revision 0)
***************
*** 0 ****
--- 1,5 ----
+ extern unsigned long volatile jiffies;
+ void do_timer(void)
+ {
+   (*(unsigned long *)&jiffies)++;
+ }


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