🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.gcc.bug
Article #1265

fix for -fpic core dump (GCC 2.3.1, sparc)

#1265
From: Paul Eggert
Date: Thu, 05 Nov 1992 04:12
35 lines
1620 bytes
gcc 2.3.1 (Sparc, SunOS 4.1.2) with just the -fpic option (or with just the
-fPIC option) dumps core when compiling the following program:

	main() { printf("Hello world\n"); }

The problem is that simplify_subtraction invokes decode_rtx_const on pc_rtx,
and decode_rtx_const doesn't know what to do if GET_CODE yields PC.  Here is a
workaround.


Thu Nov  5 01:53:38 1992  Paul Eggert  (eggert@twinsun.com)

	* varasm.c (simplify_subtraction): Don't invoke decode_rtx_const
	on PC; it won't know what do to with it.


===================================================================
RCS file: varasm.c,v
retrieving revision 2.3
retrieving revision 2.3.1.1
diff -c -r2.3 -r2.3.1.1
*** varasm.c	1992/10/29 22:29:57	2.3
--- varasm.c	1992/11/05 04:01:34	2.3.1.1
***************
*** 2214,2219 ****
--- 2214,2222 ----
  {
    struct rtx_const val0, val1;
  
+   if (XEXP (x, 0) == pc_rtx || XEXP (x, 1) == pc_rtx)
+     return XEXP (x, 0) == XEXP (x, 1) ? const0_rtx : x;
+ 
    decode_rtx_const (GET_MODE (x), XEXP (x, 0), &val0);
    decode_rtx_const (GET_MODE (x), XEXP (x, 1), &val1);
  
Technical Details
Message-ID: <9211050412.AA00335@farside.twinsun.com>
Path: arc1-ca.pugleaf.net!sparky!uunet!charon.amdahl.com!pacbell.com!decwrl!sun-barr!ames!saimiri.primate.wisc.edu!zaphod.mps.ohio-state.edu!cis.ohio-state.edu!twinsun.COM!eggert

Show Full Headers
Complete Article Headers
Newsgroups: gnu.gcc.bug
Path: arc1-ca.pugleaf.net!sparky!uunet!charon.amdahl.com!pacbell.com!decwrl!sun-barr!ames!saimiri.primate.wisc.edu!zaphod.mps.ohio-state.edu!cis.ohio-state.edu!twinsun.COM!eggert
From: eggert@twinsun.COM (Paul Eggert)
Subject: fix for -fpic core dump (GCC 2.3.1, sparc)
Message-ID: <9211050412.AA00335@farside.twinsun.com>
Sender: gnulists@ai.mit.edu
Organization: GNUs Not Usenet
Distribution: gnu
Date: Thu, 5 Nov 1992 04:12:46 GMT
Approved: bug-gcc@prep.ai.mit.edu
Lines: 36