Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!uunet!seismo!rutgers!labrea!decwrl!nsc!nsta!avi From: avi@nsta.UUCP (Avi Bloch) Newsgroups: comp.sys.nsc.32k Subject: Re: GENIX compiler 'feature' (bug) Message-ID: <323@nsta.UUCP> Date: Mon, 3-Aug-87 04:26:25 EDT Article-I.D.: nsta.323 Posted: Mon Aug 3 04:26:25 1987 Date-Received: Tue, 4-Aug-87 01:36:46 EDT References: <12301@hi.UUCP> Reply-To: avi@nsta.UUCP (Avi Bloch) Organization: National Semiconductor (Israel) Ltd. Lines: 32 Keywords: genix, c, compiler, bug In article <12301@hi.UUCP> cyrus@hi.UUCP (Tait Cyrus) writes: > >This is not the first time I have seen the GENIX C compiler generate >code where it aligned certain things on a quad boundry. Why? The >32xxx processor does not care where chars/words/ints/ptrs are, unlike >other machines. > >Granted, if an int is NOT on a word/quad boundry, it will be slower >in execution, but it WILL work. > >I guess my question is WHY is the GENIX 4.2 C compiler doing this and >is there a way to get it to NOT do this? > >Thanks in advance, > Actually, you've answered the first question yourself. The compiler puts ints/ptrs/structs on quad boundaries so that the generated code will execute faster, even though this wastes space. Most compilers will almost always give preference to speed over space. In fact, it would seem to me most unfair to penalize all users for those few who need to have everything byte-aligned. Therefore, I consider this to be a feature and not a bug. BTW, this feature is not unique to the GENIX 4.2 C compiler. The VAX/UNIX 4.3 C compiler also puts ints/ptrs/structs on quad boundaries. As to the second question, to the best of my knowledge there is no way to force byte-alignment in the compiler in question. However, National is marketing a new compiler together with its GNX 5.3 tools. The new revision of this compiler will have an option allowing the user to control the packing of records.