Xref: utzoo comp.sys.nsc.32k:836 comp.sys.encore:610 comp.sys.sequent:568 Path: utzoo!utgpu!news-server.csri.toronto.edu!rutgers!cs.utexas.edu!sdd.hp.com!hplabs!nsc!taux01!avi From: avi@taux01.UUCP (Avi Bloch) Newsgroups: comp.sys.nsc.32k,comp.sys.encore,comp.sys.sequent Subject: Re: GNU C Pointer alignments compared to other ns32k compilers Message-ID: <3773@taux01.UUCP> Date: 6 May 90 08:16:26 GMT References: Reply-To: avi@taux01.UUCP (Avi Bloch) Followup-To: comp.sys.nsc.32k Distribution: comp Organization: National Semiconductor (IC) Ltd, Israel Lines: 30 In article meissner@osf.org (Michael Meissner) writes: >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). National's GNX C compiler by default aligns both pointer variables and pointer structure members on 4 byte boundaries. However there exist compilation switches which control these alignments. Note that you can control separately the alignment within structures and the alignment of variables since there are cases where the user's need of alignment in these 2 cases do not coincide. For more information see the GNX C compiler manual or mail me and I'll be happy to answer any questions. Avi Bloch National Semiconductor (Israel) avi%taux01@nsc -- Avi Bloch National Semiconductor (Israel) 6 Maskit st. P.O.B. 3007, Herzlia 46104, Israel Tel: (972) 52-522263 avi%taux01@nsc