🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.gcc.help
Article #53626

Re: Does gcc on a sparc suffer from alignment migrains?

#53626
From: John Clark
Date: Fri, 18 Oct 1991 16:37
25 lines
1525 bytes
In article <LARRY.91Oct16143915@mitra.mitra.com> larry@mitra.mitra.com (Larry Williamson) writes:
+
+We have some code that skips through a byte stream pulling out
+interesting values. There are some values of type long in this stream,

The 'problem' is that the Sparc does want 'longs' aligned on long
boundaries. It seems that you are just experiencing the difficulty
of this hardware constraint. It would also seem that it would be
less than optimal to change the code generated by gcc to do short
accesses in all cases rather than long in type coersion, which I
presume is what you're doing. E.g.:

	char byte_stream[256];
	....
	value = *((long *)&byte_stream[i]);
		/* i not on long boundary. */

The 68020/68030 would have given the intended result that the four
bytes starting at location &byte_stream[i] would be assigned to
'value'. The sparc would bus error if the address was aligned to
either odd short or odd byte.
-- 

John Clark
jclark@ucsd.edu
Technical Details
Message-ID: <24603@sdcc6.ucsd.edu>
Path: arc1-ca.pugleaf.net!gmdzi!unido!mcsun!uunet!ogicse!ucsd!sdcc6!jclark
References: <LARRY.91Oct16143915@mitra.mitra.com>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 11318c,149bc2b7ad9a0d9f
X-Google-Attributes: gid11318c,public
X-Google-ArrivalTime: 1991-10-19 07:17:43 PST
Path: arc1-ca.pugleaf.net!gmdzi!unido!mcsun!uunet!ogicse!ucsd!sdcc6!jclark
From: jclark@sdcc6.ucsd.edu (John Clark)
Newsgroups: gnu.gcc.help
Subject: Re: Does gcc on a sparc suffer from alignment migrains?
Message-ID: <24603@sdcc6.ucsd.edu>
Date: 18 Oct 91 16:37:06 GMT
References: <LARRY.91Oct16143915@mitra.mitra.com>
Organization: University of California, San Diego
Lines: 25