From: "Maciej W. Rozycki" <macro@ds2.pg.gda.pl>
To: axp-list@redhat.com
Subject: Re: problem with unaligned access on Alpha
Date: Wed, 23 Jun 1999 16:55:31 +0200 (MET DST) [thread overview]
Message-ID: <Pine.GSO.3.96.990623161434.16101A-100000@delta.ds2.pg.gda.pl> (raw)
In-Reply-To: <41256799.00395D39.00@saturn.aladdin.de>
On Wed, 23 Jun 1999, Christian Groessler wrote:
> But it also happens with egcs-1.1.2 (on NetBSD, but I don't think this
> makes a difference).
>
> OK, now that I know whats the problem I can avoid the unaligned access and
> fix the program. But I initially relied on unaligned accesses being
> signalled
> by the kernel, and now that the compiler works around unaligned accesses
> (in a buggy way) makes it much more difficult to get alignment-unaware
> (intel)
> apps running on Alpha....
Well, unless you interchange non-byte data between architectures all
accesses should be aligned by the compiler. If you cast between types of
different alignments, you may make the compiler be aware of wrong
alignment by casting the type to an unaligned one. E.g. you may cast
unaligned "int32_t" to "struct { int32_t __attribute__((packed)); }" (it's
not written formally but it should give you the idea); I'm told it works
with egcs 1.1.2 which will add a necessary code to fetch the whole object
properly.
If you interchange non-byte data between architectures then you have to
take care of different endianness anyway and you can simply apply
alignment fixes to all places where you swap bytes for correct endianness.
This is what I did in the program I am currently porting to multi-arch.
I also observed the compiler behaviour you described. I believe it's a
bug unless egcs people have a proof it's a feature. I think the most
reasonable (i.e. performance-wise) solution is to change the unaligned
load to the aligned one and let the kernel trap it. Given the compiler
can be told explicitly to handle unaligned data this solution seems to be
the right one. Have you reported the bug to egcs folks?
--
+ Maciej W. Rozycki, Technical University of Gdansk, Poland +
+--------------------------------------------------------------+
+ e-mail: macro@ds2.pg.gda.pl, PGP key available +
next prev parent reply other threads:[~1999-06-23 15:55 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
1999-06-23 10:23 problem with unaligned access on Alpha Christian Groessler
1999-06-23 14:55 ` Maciej W. Rozycki [this message]
1999-06-23 14:56 ` Michal Jaegermann
1999-06-23 16:23 ` Maciej W. Rozycki
1999-06-24 7:02 ` Michal Jaegermann
1999-06-25 20:21 ` Maciej W. Rozycki
-- strict thread matches above, loose matches on Subject: below --
1999-06-29 9:12 Wessels, Hans
1999-06-29 15:07 ` Michal Jaegermann
1999-07-05 17:23 ` Maciej W. Rozycki
1999-06-24 8:54 Christian Groessler
1999-06-24 8:29 Christian Groessler
1999-06-24 15:26 ` Michal Jaegermann
1999-06-22 10:59 Christian Groessler
1999-06-22 12:32 ` Stefan Katzenbeisser
read-only archive
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox