This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: PATCH: `__norestrict' type qualifier
- To: egcs at tantalophile dot demon dot co dot uk (Jamie Lokier)
- Subject: Re: PATCH: `__norestrict' type qualifier
- From: Joern Rennecke <amylaar at cygnus dot co dot uk>
- Date: Wed, 21 Jul 1999 20:21:30 +0100 (BST)
- Cc: chip at perlsupport dot com, patl at curl dot com, jbuck at Synopsys dot COM, torvalds at transmeta dot com, toon at moene dot indiv dot nluug dot nl, mark at codesourcery dot com, egcs at egcs dot cygnus dot com
> > > I don't think that's relevant to alignment as we meant it: there are
> > > no unaligned pointers on those machines!
> >
> > That's my point. A char* can be incorrectly aligned to extract a
> > word, if the byte index is nonzero. But a word* can't be. Therefore
> > if you define __norestrict pointers in terms of char* copying, then
> > you must allow for nonaligned words, and therefore you must make all
> > __norestrict pointers "fat". This would be a Bad Thing.
>
> :-) Just as you must make __norestrict pointers fat on machines with
> different types in different memory spaces.
>
> Still doesn't get us a definition of alignment. It's hard: you might
> access a short array using __norestrict long *, and you can't even talk
> in terms of the offset into the short array, as the array might only
> have short alignment.
Could we drop this __nonrestrict / __typealias thing and instead just say
that gcc will implement pointer to unions so that they just work as
desired? E.g. to do your copy-aligned-block-as-ints thing:
typedef union { char c; int i; } *ipnt;
copy (ipnt dest, ipnt src, words)
{
while (--words >= 0)
dest->i = src->i;
}
double d1[20], d2[20];
f()
{
copy ((ipnt)(char *)d1, (ipnt)(char *)d2, sizeof d1 / sizeof (int));
}