combine versus hard reg loads/stores fix fix

Jan Hubicka jh@suse.cz
Tue Dec 12 03:43:00 GMT 2000


Hi Bernd,
The hardreg<->reg moves may contain SUBREGs making gcc to crash on certain testcases.
For x86_64 it is:

extern void * ext2_bread (void *, int, int, int *);
static int empty_dir (unsigned long offset, int bs)
{
        ext2_bread (0, offset >> bs, 0, 0);
        return 1;
}

In this case the offset>>bs is computed 64bit and then SUBREGed for i386.  On
i386 this is quite dificult, since we can't force SUBREG on the operand,
because all arguments are promoted to the widest mode.

OK?

Honza

Tue Dec 12 12:41:51 MET 2000  Jan Hubicka  <jh@suse.cz>

	* combine.c (cant_combine_insn_p): Get around SUBREGs when determining
	hardreg<->reg moves.

Index: gcc/gcc/combine.c
===================================================================
RCS file: /home/cvs/Repository/gcc/gcc/combine.c,v
retrieving revision 1.6
diff -c -3 -p -r1.6 combine.c
*** gcc/gcc/combine.c	2000/12/07 17:40:41	1.6
--- gcc/gcc/combine.c	2000/12/12 11:02:21
*************** cant_combine_insn_p (insn)
*** 1465,1470 ****
--- 1465,1474 ----
      return 0;
    src = SET_SRC (set);
    dest = SET_DEST (set);
+   if (GET_CODE (src) == SUBREG)
+     src = SUBREG_REG (src);
+   if (GET_CODE (dest) == SUBREG)
+     dest = SUBREG_REG (dest);
    if (REG_P (src) && REG_P (dest)
        && ((REGNO (src) < FIRST_PSEUDO_REGISTER
  	   && ! fixed_regs[REGNO (src)])


More information about the Gcc mailing list