patch for core dump in cse with -O2 on x86

Zack Weinberg zack@rabi.columbia.edu
Thu Oct 15 14:25:00 GMT 1998


The appended patch fixes a core dump in cse.  If HAVE_cc0 is defined,
fold_rtx may try to call equiv_constant with a null rtx.  This case is
triggered by skip_comment() in cpplib.c in the current source tree.

The patch makes equiv_constant return 0 in this case, which should be
sane.

zw

1998-10-15 17:20 -0400  Zack Weinberg  <zack@rabi.phys.columbia.edu>

	* cse.c (equiv_constant): Check for null argument.

Index: cse.c
===================================================================
RCS file: /egcs/carton/cvsfiles/egcs/gcc/cse.c,v
retrieving revision 1.49
diff -u -r1.49 cse.c
--- cse.c	1998/10/13 11:39:26	1.49
+++ cse.c	1998/10/15 21:16:49
@@ -5855,7 +5855,8 @@
 equiv_constant (x)
      rtx x;
 {
-  if (GET_CODE (x) == REG
+  if (x != 0
+      && GET_CODE (x) == REG
       && REGNO_QTY_VALID_P (REGNO (x))
       && qty_const[reg_qty[REGNO (x)]])
     x = gen_lowpart_if_possible (GET_MODE (x), qty_const[reg_qty[REGNO (x)]]);



More information about the Gcc-patches mailing list