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]

Re: i386 bootstrap failure - analysis


On Fri, Jun 22, 2001 at 11:02:14PM -0700, Zack Weinberg wrote:
> So I'm inclined to suspect initial RTL generation.

Good analysis.  The initial rtl is in fact wrong -- code_label 281
is not in the instruction stream anywhere.

The problem is with Meissner's __builtin_expect jump optimization.
It may evaluate an expression twice.  Not all expressions can be
re-evaluated; the most common evil form being STMT_EXPR.

Fixed thus.


r~

        * builtins.c (expand_builtin_expect_jump): Disable if the 
        expression can't be re-evaluated.

Index: builtins.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/builtins.c,v
retrieving revision 1.101
diff -c -p -d -r1.101 builtins.c
*** builtins.c	2001/06/20 07:18:07	1.101
--- builtins.c	2001/06/24 16:07:47
*************** expand_builtin_expect_jump (exp, if_fals
*** 3304,3309 ****
--- 3304,3325 ----
        int j;
        int num_jumps = 0;
  
+       /* If we fail to locate an appropriate conditional jump, we'll
+ 	 fall back to normal evaluation.  Ensure that the expression
+ 	 can be re-evaluated.  */
+       switch (unsafe_for_reeval (arg0))
+ 	{
+ 	case 0: /* Safe.  */
+ 	  break;
+ 
+ 	case 1: /* Mildly unsafe.  */
+ 	  arg0 = unsave_expr (arg0);
+ 	  break;
+ 
+ 	case 2: /* Wildly unsafe.  */
+ 	  return NULL_RTX;
+ 	}
+ 
        /* Expand the jump insns.  */
        start_sequence ();
        do_jump (arg0, if_false_label, if_true_label);


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