🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.sys.nsc.32k
Article #117

GNU C Pointer alignments compared to other ns32k compilers

#117
From: Michael Meissner
Date: Wed, 02 May 1990 15:28
32 lines
1855 bytes
Our kernel group recently noticed that by default, the native C
compiler on Encore's Mach system aligns pointers on 4 byte boundaries
(which is reasonable).  As far as I can tell, this compiler is
originally produced by Greenhills.  The current sources of GNU C for
the National 32k only aligns pointers to 2 byte boundaries.  Needless
to say, this can cause things to go at the wrong address when building
structures.  I was wondering if this were purely an Encore feature, a
Greenhills feature, and what other ns32k compilers do.  If you run the
following program, it will print 2 if your compiler does no padding,
or pads to a 16-bit boundary, and it will print 4 if it pads to a
32-bit boundary.  In particular, I would be interested in the non-4
answers (since I already changed my version of the sources).  If you
want to change your GCC sources, edit the file config/tm-ns32k.h, and
change POINTER_BOUNDARY from '16' to '32'.

-------------------- cut here --------------------
struct {
	char first;
	char *second;
} st;

main(){
	printf("Pointers require %d byte alignment\n",
		(int)(((char *) &st.second) - ((char *) &st)));
	return 0;
}
-------------------- cut here --------------------
--
Michael Meissner	email: meissner@osf.org		phone: 617-621-8861
Open Software Foundation, 11 Cambridge Center, Cambridge, MA

Catproof is an oxymoron, Childproof is nearly so
Technical Details
Message-ID: <MEISSNER.90May2112857@curley.osf.org>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!sdd.hp.com!think!paperboy!meissner

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!sdd.hp.com!think!paperboy!meissner
From: meissner@osf.org (Michael Meissner)
Newsgroups: comp.sys.nsc.32k,comp.sys.encore,comp.sys.sequent
Subject: GNU C Pointer alignments compared to other ns32k compilers
Message-ID: <MEISSNER.90May2112857@curley.osf.org>
Date: 2 May 90 15:28:57 GMT
Sender: news@OSF.ORG
Distribution: comp
Organization: Open Software Foundation
Lines: 32