🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.gcc.bug
Article #1735

fold_rtx returns garbage for zero_extend:DI

#1735
From: Rob McMahon
Date: Tue, 27 Sep 1988 23:27
46 lines
1918 bytes
GCC 1.28, Gould PN6000

Given an expression like (*_extend:DI (reg:SI ...)) which reduces to something
like (*_extend:DI (const_int ...)) once constants have been substituted,
fold_rtx tries to do the extend itself with logical operations, putting the
resulting value in `val', and later passing this to `gen_rtx (CONST_INT,
VOIDmode, val)'.  It knows not to do the logical operations if the size of the
original mode (SImode here) is == the word size, but in this case it leaves
`val' uninitialised, and carries on through the rest of the logic.  If `val'
happens to contain a legitimate constant, a garbage value is returned.

Fix:

RCS file: cse.c,v
retrieving revision 1.9.1.1
diff -c -r1.9.1.1 cse.c
*** /tmp/,RCSt1a01125	Wed Sep 28 00:24:43 1988
--- cse.c	Wed Sep 28 00:10:31 1988
***************
*** 1852,1857 ****
--- 1852,1859 ----
  	      return x;
  	    if (GET_MODE_BITSIZE (mode) < HOST_BITS_PER_INT)
  	      val = arg0 & ~((-1) << GET_MODE_BITSIZE (mode));
+ 	    else
+ 	      val = arg0;
  	    break;
  	  }
  
***************
*** 1866,1871 ****
--- 1868,1875 ----
  		if (val & (1 << (GET_MODE_BITSIZE (mode) - 1)))
  		  val -= 1 << GET_MODE_BITSIZE (mode);
  	      }
+ 	    else
+ 	      val = arg0;
  	    break;
  	  }
  

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
Technical Details
Message-ID: <55@titania.warwick.ac.uk>
Path: arc1-ca.pugleaf.net!utzoo!telly!ddsw1!mcdchg!rutgers!labrea!eos!ames!amdahl!uunet!axion!ist!icdoc!ukc!warwick!cudcv

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!telly!ddsw1!mcdchg!rutgers!labrea!eos!ames!amdahl!uunet!axion!ist!icdoc!ukc!warwick!cudcv
From: cudcv@warwick.ac.uk (Rob McMahon)
Newsgroups: gnu.gcc.bug
Subject: fold_rtx returns garbage for zero_extend:DI
Message-ID: <55@titania.warwick.ac.uk>
Date: 27 Sep 88 23:27:46 GMT
Reply-To: cudcv@warwick.ac.uk (Rob McMahon)
Organization: Computing Services, Warwick University, UK
Lines: 46