🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.gcc.bug
Article #676

Changes to 1.36 hard-params for use on pyramid.

#676
From: ...But we WILL find it!
Date: Tue, 03 Oct 1989 23:44
121 lines
4247 bytes
Bob McQueer here sent me the following changes to hard-params.c, from the
gcc 1.36 distribution, after noticing the original thought chars had 3
byte alignment.

hope this is of interest,

-dB

Date: Tue, 3 Oct 89 16:34:16 PDT
To: daveb@llama.rtech.com
From: bobm@weevil.rtech.com
Subject: hard-params

A few tweaks:

	1) changed the alignment calculation.  It now gives numbers which
	   seem more believable on the pyramids.

	2) added function pointers to the basic types, produced alignments
	   for float and pointer types.

	3) put in a check for format differences between char * and int *.
	   The check claims "identical" on sun and "different" on DG, so
	   maybe it serves some purpose.

-----------------
*** ohardp.c	Tue Oct  3 15:22:34 1989
--- hardp.c	Tue Oct  3 16:14:04 1989
***************
*** 719,725 ****
--- 719,741 ----
  	return bits_per_byte;
  }
  
+ typedef (*FPTR)();
+ 
  int basic() {
+ 	struct { char c; char d; } calg;
+ 	struct { char c; short d; } salg;
+ 	struct { char c; int d; } ialg;
+ 	struct { char c; long d; } lalg;
+ 	struct { char c; float d; } falg;
+ 	struct { char c; double d; } dalg;
+ 	struct { char c; char *d; } cpalg;
+ 	struct { char c; int *d; } ipalg;
+ 	struct { char c; FPTR d; } fpalg;
+ 
+ 	long iaddr,caddr;
+ 	char *cptr;
+ 	int *iptr;
+ 
  	/* The properties of the basic types.
  	   Returns number of bits per sizeof unit */
  	volatile int bits_per_byte;
***************
*** 746,751 ****
--- 762,771 ----
  		co, (int)sizeof(int *)*bits_per_byte,
  		sizeof(int *)>sizeof(int)?" BEWARE! larger than int!":"",
  		oc);
+ 	Vprintf("%sFunction pointers = %d bits%s%s\n",
+ 		co, (int)sizeof(FPTR)*bits_per_byte,
+ 		sizeof(int *)>sizeof(int)?" BEWARE! larger than int!":"",
+ 		oc);
  	sprop();
  	iprop();
  	lprop();
***************
*** 758,768 ****
  	/* Alignment constants ********************************************/
  	Vprintf("%sAlignments used for char=%d short=%d int=%d long=%d%s\n",
  		co,
! 		(int)sizeof(struct{char i1; char c1;})-(int)sizeof(char),
! 		(int)sizeof(struct{short i2; char c2;})-(int)sizeof(short),
! 		(int)sizeof(struct{int i3; char c3;})-(int)sizeof(int),
! 		(int)sizeof(struct{long i4; char c4;})-(int)sizeof(long),
  		oc);
  
  	/* Ten little endians *********************************************/
  
--- 778,799 ----
  	/* Alignment constants ********************************************/
  	Vprintf("%sAlignments used for char=%d short=%d int=%d long=%d%s\n",
  		co,
! 		((char *) &(calg.d)) - ((char *) &(calg.c)),
! 		((char *) &(salg.d)) - ((char *) &(salg.c)),
! 		((char *) &(ialg.d)) - ((char *) &(ialg.c)),
! 		((char *) &(lalg.d)) - ((char *) &(lalg.c)),
  		oc);
+ 	Vprintf("%sAlignments used for float=%d double=%d%s\n",
+ 		co,
+ 		((char *) &(falg.d)) - ((char *) &(falg.c)),
+ 		((char *) &(dalg.d)) - ((char *) &(dalg.c)),
+ 		oc);
+ 	Vprintf("%sAlignments used for char ptr=%d int ptr=%d func ptr=%d%s\n",
+ 		co,
+ 		((char *) &(cpalg.d)) - ((char *) &(cpalg.c)),
+ 		((char *) &(ipalg.d)) - ((char *) &(ipalg.c)),
+ 		((char *) &(fpalg.d)) - ((char *) &(fpalg.c)),
+ 		oc);
  
  	/* Ten little endians *********************************************/
  
***************
*** 774,779 ****
--- 805,819 ----
  			printf("%sStrings are shared%s\n", co, oc);
  		else printf("%sStrings are not shared%s\n", co, oc);
  	}
+ 
+ 	cptr = (char *) &iaddr;
+ 	iptr = (int *) &iaddr;
+ 	caddr = (long) cptr;
+ 	iaddr = (long) iptr;
+ 	if (iaddr == caddr)
+ 		printf("%sChar and int pointer formats appear identical%s\n", co, oc);
+ 	else
+ 		printf("%sChar and int pointer formats seem different%s\n", co, oc);
  
  	return bits_per_byte;
  }
Technical Details
Message-ID: <8910032344.AA11680@llama.rtech.com>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!rutgers!apple!gem.mps.ohio-state.edu!tut.cis.ohio-state.edu!EDDIE.MIT.EDU!think!rtech!llama!daveb

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!rutgers!apple!gem.mps.ohio-state.edu!tut.cis.ohio-state.edu!EDDIE.MIT.EDU!think!rtech!llama!daveb
From: think!rtech!llama!daveb@EDDIE.MIT.EDU (...But we WILL find it!)
Newsgroups: gnu.gcc.bug
Subject: Changes to 1.36 hard-params for use on pyramid.
Message-ID: <8910032344.AA11680@llama.rtech.com>
Date: 3 Oct 89 23:44:14 GMT
Sender: daemon@tut.cis.ohio-state.edu
Distribution: gnu
Organization: GNUs Not Usenet
Lines: 121