[gnu.gcc.bug] GCC 1.28 aborts in gen_lowpart in combine stage

cudcv@warwick.ac.uk (Rob McMahon) (09/28/88)

GCC 1.28, Gould PN6000

While trying to simplify combinations like (zero_extend:DI (and:SI (reg:SI ...)
(const_int ...))), subst will call gen_lowpart_for_combine with mode DImode,
which calls gen_lowpart, which aborts.  I believe the problem is that
FAKE_EXTEND_SAFE_P should not accept modes bigger than a word.  Rejecting them
prevents subst from trying these simplifications, and it seems you could only
do this fake extension to DImode from a stack slot, you may not be able to
extend any old register.

Suggested fix:

RCS file: combine.c,v
retrieving revision 1.9
diff -c -r1.9 combine.c
*** /tmp/,RCSt1a01177	Wed Sep 28 00:43:12 1988
--- combine.c	Tue Sep 27 23:17:23 1988
***************
*** 730,737 ****
     If not for that, MEM's would very rarely be safe.  */
  
  #define FAKE_EXTEND_SAFE_P(MODE, FROM) \
!   (GET_CODE (FROM) == REG || GET_CODE (FROM) == SUBREG \
!    || GET_CODE (FROM) == MEM)
  
    if (x == from)
      return to;
--- 730,738 ----
     If not for that, MEM's would very rarely be safe.  */
  
  #define FAKE_EXTEND_SAFE_P(MODE, FROM) \
!   (GET_MODE_SIZE (MODE) <= UNITS_PER_WORD			\
!    && (GET_CODE (FROM) == REG || GET_CODE (FROM) == SUBREG	\
!        || GET_CODE (FROM) == MEM))
  
    if (x == from)
      return to;

Rob
-- 
UUCP:   ...!mcvax!ukc!warwick!cudcv	PHONE:  +44 203 523037
JANET:  cudcv@uk.ac.warwick             ARPA:   cudcv@warwick.ac.uk
Rob McMahon, Computing Services, Warwick University, Coventry CV4 7AL, England