This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
Re: c/859: sparc-specific pessimal code for simple loop
- To: rth at redhat dot com
- Subject: Re: c/859: sparc-specific pessimal code for simple loop
- From: Jim Wilson <wilson at cygnus dot com>
- Date: Wed, 22 Nov 2000 13:00:27 -0800
- Cc: gcc-bugs at gcc dot gnu dot org
- References: <20001121213559.26387.qmail@sourceware.cygnus.com>
In article <20001121230119.A19367@redhat.com> you write:
>This is a STRICT_ALIGNMENT machine, therefore DFmode and DImode
>operands must be 8-byte aligned, thus the EXTRA_CONSTRAINT check
>ought to be redundant, no?
No. The old 32-bit ABI only guarantees a max of 4-byte alignment. GCC
will always give you 8 byte alignment for DFmode/DImode values, but if you
are linking with code compiled by some other compiler, then you may get
passed in pointers to 4-byte aligned values.
Here is an example. If I compile this with cc on a SunOS4 machine, then I
hit the abort because I have a 4-byte aligned pointer to DFmode data.
I do not hit the abort if I compile with gcc, because gcc aligns the data
before taking its address.
void
sub2 (dptr)
double *dptr;
{
if ((long)dptr & 0x7)
abort ();
}
void
sub1 (a, b, c, d, e, f, g)
int a, b, c, d, e, f;
double g;
{
sub2 (&g);
}
int
main()
{
sub1 (0, 1, 2, 3, 4, 5, 7.0);
}