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]

PATCH: gcc-3.0 --target=m68k build failure patch


version: gcc-3.0
   host: i686-linux (Red Hat 7.0)
 target: m68k-elf

Build of the cross-compiler fails at this point:

/home/tm/gcc-3.0-m68k-elf/gcc/xgcc -B/home/tm/gcc-3.0-m68k-elf/gcc/ -B/usr/local/m68k-elf/bin/ -B/usr/local/m68k-elf/lib/ -isystem /usr/local/m68k-elf/include -DCROSS_COMPILE -DIN_GCC    -W -Wall -Wwrite-strings -Wstrict-prototypes -Wmissing-prototypes -isystem ./include  -I. -I. -I../../gcc-3.0/gcc -I../../gcc-3.0/gcc/. -I../../gcc-3.0/gcc/config -I../../gcc-3.0/gcc/../include  -g0 \
  -finhibit-size-directive -fno-inline-functions \
  -fno-exceptions  -Dinhibit_libc \
  -c ../../gcc-3.0/gcc/crtstuff.c -DCRT_BEGIN -o crtbegin.o
../../gcc-3.0/gcc/crtstuff.c: In function `__do_global_dtors_aux':
../../gcc-3.0/gcc/crtstuff.c:225: Internal compiler error in expected_value_to_br_prob, at predict.c:303
Please submit a full bug report,
with preprocessed source if appropriate.
See <URL:http://www.gnu.org/software/gcc/bugs.html> for instructions.

The relevant code in predict.c is:

      /* Substitute and simplify.  Given that the expression we're
         building involves two constants, we should wind up with either
         true or false.  */
      cond = gen_rtx_fmt_ee (GET_CODE (cond), VOIDmode,
                             XEXP (ev, 1), XEXP (cond, 1));
      cond = simplify_rtx (cond);

      /* Turn the condition into a scaled branch probability.  */
      if (cond == const1_rtx)
        cond = GEN_INT (PROB_VERY_LIKELY);
      else if (cond == const0_rtx)
        cond = GEN_INT (PROB_VERY_UNLIKELY);
      else
        abort ();

When the abort is triggered, dumping out cond reveals:

(xxgdb) call debug_rtx(cond)

(const_int -1 [0xffffffff])

It looks like simplify_rtx calls simplify_relational_operation,
and the comment header for this function is:

/* Like simplify_binary_operation except used for relational operators.
   MODE is the mode of the operands, not that of the result.  If MODE
   is VOIDmode, both operands must also be VOIDmode and we compare the
   operands in "infinite precision".

   If no simplification is possible, this function returns zero.  Otherwise,
   it returns either const_true_rtx or const0_rtx.  */


Let's look at const_true_rtx:

(xxgdb) call debug_rtx(const_true_rtx)
(const_int -1 [0xffffffff])

So, it appears the comparison at predict.c:298 is wrong.
It should check for const_true_rtx, not const1_rtx.

Fri Jun 22 01:27:09 PDT 2001  Toshiyasu Morita  (toshiyasu.morita@hsa.hitachi.com)

	* predict.c: (expected_value_to_br_prob): Check for const_true_rtx
	instead of const1_rtx for true case.

*** predict.c.bak	Fri Jun 22 01:11:00 2001
--- predict.c	Fri Jun 22 01:31:39 2001
***************
*** 295,301 ****
        cond = simplify_rtx (cond);
  
        /* Turn the condition into a scaled branch probability.  */
!       if (cond == const1_rtx)
  	cond = GEN_INT (PROB_VERY_LIKELY);
        else if (cond == const0_rtx)
  	cond = GEN_INT (PROB_VERY_UNLIKELY);
--- 295,301 ----
        cond = simplify_rtx (cond);
  
        /* Turn the condition into a scaled branch probability.  */
!       if (cond == const_true_rtx)
  	cond = GEN_INT (PROB_VERY_LIKELY);
        else if (cond == const0_rtx)
  	cond = GEN_INT (PROB_VERY_UNLIKELY);

Passed bootstrap on i686-linux with this patch.

Toshi


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