*** gcc/sched-deps.c.0	2010-09-27 23:58:17.000000000 +0200
--- gcc/sched-deps.c	2010-09-28 00:03:05.000000000 +0200
*************** sched_insn_is_legitimate_for_speculation
*** 597,604 ****
      /* The following instructions, which depend on a speculatively scheduled
         instruction, cannot be speculatively scheduled along.  */
      {
!       if (may_trap_p (PATTERN (insn)))
! 	/* If instruction might trap, it cannot be speculatively scheduled.
  	   For control speculation it's obvious why and for data speculation
  	   it's because the insn might get wrong input if speculation
  	   wasn't successful.  */
--- 597,604 ----
      /* The following instructions, which depend on a speculatively scheduled
         instruction, cannot be speculatively scheduled along.  */
      {
!       if (may_trap_or_fault_p (PATTERN (insn)))
! 	/* If instruction might fault, it cannot be speculatively scheduled.
  	   For control speculation it's obvious why and for data speculation
  	   it's because the insn might get wrong input if speculation
  	   wasn't successful.  */
*** gcc/tree.c.0	2010-09-26 13:31:06.000000000 +0200
--- gcc/tree.c	2010-09-26 17:25:20.000000000 +0200
*************** substitute_in_expr (tree exp, tree f, tr
*** 3133,3138 ****
--- 3133,3142 ----
        }
  
    TREE_READONLY (new_tree) |= TREE_READONLY (exp);
+ 
+   if (code == INDIRECT_REF || code == ARRAY_REF || code == ARRAY_RANGE_REF)
+     TREE_THIS_NOTRAP (new_tree) |= TREE_THIS_NOTRAP (exp);
+ 
    return new_tree;
  }
  
*************** substitute_placeholder_in_expr (tree exp
*** 3300,3305 ****
--- 3304,3313 ----
        }
  
    TREE_READONLY (new_tree) |= TREE_READONLY (exp);
+ 
+   if (code == INDIRECT_REF || code == ARRAY_REF || code == ARRAY_RANGE_REF)
+     TREE_THIS_NOTRAP (new_tree) |= TREE_THIS_NOTRAP (exp);
+ 
    return new_tree;
  }
  
*** gcc/tree-inline.c.0	2010-09-26 13:30:54.000000000 +0200
--- gcc/tree-inline.c	2010-09-26 13:41:34.000000000 +0200
*************** remap_gimple_op_r (tree *tp, int *walk_s
*** 845,850 ****
--- 845,852 ----
  	              *tp = build1 (INDIRECT_REF, type, new_tree);
  		      TREE_THIS_VOLATILE (*tp) = TREE_THIS_VOLATILE (old);
  		      TREE_NO_WARNING (*tp) = TREE_NO_WARNING (old);
+ 		      TREE_READONLY (*tp) = TREE_READONLY (old);
+ 		      TREE_THIS_NOTRAP (*tp) = TREE_THIS_NOTRAP (old);
  		    }
  		}
  	      *walk_subtrees = 0;
*************** copy_tree_body_r (tree *tp, int *walk_su
*** 1080,1085 ****
--- 1082,1089 ----
  	              *tp = build1 (INDIRECT_REF, type, new_tree);
  		      TREE_THIS_VOLATILE (*tp) = TREE_THIS_VOLATILE (old);
  		      TREE_SIDE_EFFECTS (*tp) = TREE_SIDE_EFFECTS (old);
+ 		      TREE_READONLY (*tp) = TREE_READONLY (old);
+ 		      TREE_THIS_NOTRAP (*tp) = TREE_THIS_NOTRAP (old);
  		    }
  		}
  	      *walk_subtrees = 0;
