[gnu.gcc.bug] gcc 1.33 vax gets signal 10

raeburn@ATHENA.MIT.EDU (Ken Raeburn) (02/13/89)

In compiling the file:

    struct format_data
    {
      char format;
      char size;
    };

    decode_format (string_ptr)
	 char **string_ptr;
    {
      struct format_data val;
      register char *p = *string_ptr;

      val.size = *p++;
    }

with optimization enabled, under gcc 1.33 with two patches from RMS, I
get a bus error.  (The file is a very stripped-down function from gdb
3.1.)  The CSE pass dumps core in trying to use REGNO(SUBREG_REG(x))
when x is of the form (SUBREG (MEM)).

The patch I've put in place that seems to fix it is:

*** /tmp/,RCSt1001028   Mon Feb 13 09:01:03 1989
--- cse.c       Mon Feb 13 08:55:38 1989
***************
*** 2392,2397 ****
--- 2392,2398 ----
    /* If integer truncation is being done with SUBREG,
       we can compute the result.  */
    else if (GET_CODE (x) == SUBREG && SUBREG_WORD (x) == 0
+            && GET_CODE (SUBREG_REG (x)) == REG
             && (tem1 = qty_const[reg_qty[REGNO (SUBREG_REG (x))]]) != 0
             /* Make sure it is a known integer.  */
             && GET_CODE (tem1) == CONST_INT

However, according to the documentation, (SUBREG (MEM)) should only be
found between the combiner and reloader passes, and CSE is listed well
before the combiner pass, so either the documentation needs updating
or this fix is insufficient.

-- Ken Raeburn
   MIT Project Athena