[committed] Fix MIPS expand_expr_addr_expr fallout

Richard Sandiford rsandifo@redhat.com
Wed Sep 15 09:06:00 GMT 2004


This patch fixes ICEs in gcc.c-torture/compile/961019-1.c and
gcc.dg/20020222-1.c on mips-sgi-irix6.5.  They triggered during 
the ivopts pass, which wanted to know the rtx cost of:

    (char) ivtmp - (char) &hex_value[48]

where the "(char)"s are (of course) NOP_EXPRs.

The NOP_EXPR case of expand_expr tries to expand a NOP_EXPR's operand with
TMODE set to the NOP_EXPR's mode instead of the operand's mode.  In this case
the NOP_EXPR's mode is QImode and expand_expr_addr_expr dutifuly returns:

   (const:QI (plus:QI (symbol_ref:QI "hex_value") (const_int 48)))

Unfortunately, the MIPS move expanders can't handle this sort of thing.

I remember that, in the thread about the IA64 bootstrap failure, it was
said that we need to convert memory addresses for things other than Pmode
and ptr_mode, so this behaviour might well be intentional.  Even it _isn't_
intentional, it shows up a problem in the MIPS backend, which has a redudant
definition of POINTERS_EXTEND_UNSIGNED.  (The definition is redundant because
Pmode always equals ptr_mode on this target.  Any code to change the mode of
symbolic constants is both unnecessary and (as this bug shows) a little
dangerous.)

Bootstrapped & regression tested on mips-sgi-irix6.5.  Applied to mainline.

Richard


	* config/mips/mips.h (POINTERS_EXTEND_UNSIGNED): Delete.

Index: config/mips/mips.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/mips/mips.h,v
retrieving revision 1.367
diff -c -p -F^\([(a-zA-Z0-9_]\|#define\) -r1.367 mips.h
*** config/mips/mips.h	8 Sep 2004 18:45:11 -0000	1.367
--- config/mips/mips.h	15 Sep 2004 06:08:23 -0000
*************** #define MAX_FIXED_MODE_SIZE LONG_DOUBLE_
*** 1295,1302 ****
  #define POINTER_SIZE ((TARGET_LONG64 && TARGET_64BIT) ? 64 : 32)
  #endif
  
- #define POINTERS_EXTEND_UNSIGNED 0
- 
  /* Allocation boundary (in *bits*) for storing arguments in argument list.  */
  #define PARM_BOUNDARY ((mips_abi == ABI_O64 \
  			|| TARGET_NEWABI \
--- 1295,1300 ----



More information about the Gcc-patches mailing list