public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
* target/7462: Bad code for unalign access on PPC
@ 2002-07-31 22:56 Hans-Joachim Widmaier
0 siblings, 0 replies; only message in thread
From: Hans-Joachim Widmaier @ 2002-07-31 22:56 UTC (permalink / raw)
To: gcc-gnats
>Number: 7462
>Category: target
>Synopsis: Bad code for unalign access on PPC
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: unassigned
>State: open
>Class: pessimizes-code
>Submitter-Id: net
>Arrival-Date: Wed Jul 31 22:56:02 PDT 2002
>Closed-Date:
>Last-Modified:
>Originator:
>Release: 3.1.1
>Organization:
Foxboro Eckardt Development GmbH
>Environment:
System: Linux linux1 2.4.10-4GB #1 Tue Sep 25 12:33:54 GMT 2001 i686 unknown
Architecture: i686
host: i686-pc-linux-gnu
build: i686-pc-linux-gnu
target: powerpc-unknown-rtems
configured with: /pub/build/gcc-3.1.1/configure --host=i686-pc-linux-gnu --target=powerpc-rtems --disable-nls --disable-shared --enable-languages=c --with-newlib --with-cpu=405 --enable-threads=rtems
>Description:
Unaligned accesses to short/long/float variables in memory generate code which does multiple
byte loads/stores with masking and shifting instead of 1 halfword/word load/store.
On processors that do not support unaligned accesses this is the correct thing
to do. For those that do, it is worse than just creating bad code: if the
variable happens to live in a little-endian memory region it will not be swapped and
therefore be invalid.
>How-To-Repeat:
The code was compiled with: powerpc-rtems-gcc -fallow-single-precision -mno-strict-align -fsingle-precision-constant -mcpu=405 -mtune=405 -O2 -c align.c
# 1 "align.c"
# 1 "<built-in>"
# 1 "<command line>"
# 1 "align.c"
#pragma pack(1)
struct atest {
char b;
float f;
long l;
} ATest;
# 26 "align.c"
void bad(void)
{
ATest.f *= 6.5;
ATest.l *= 6;
}
void ok(void)
{
*&ATest.f *= 6.5;
*&ATest.l *= 6;
}
>Fix:
The split-up into byte accesses is not done when the memory is accessed via a pointer as
in function ok() above.
>Release-Note:
>Audit-Trail:
>Unformatted:
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2002-08-01 5:56 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-07-31 22:56 target/7462: Bad code for unalign access on PPC Hans-Joachim Widmaier
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).