This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: i386 bootstrap failure - analysis
- To: Zack Weinberg <zackw at stanford dot edu>
- Subject: Re: i386 bootstrap failure - analysis
- From: Richard Henderson <rth at redhat dot com>
- Date: Sun, 24 Jun 2001 09:14:54 -0700
- Cc: gcc at gcc dot gnu dot org, gcc-patches at gcc dot gnu dot org, Michael Meissner <meissner at redhat dot com>
- References: <20010622230214.F3048@stanford.edu>
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);