This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: PATCH: `__norestrict' type qualifier


Patrick J. LoPresti wrote:
>  Jamie>    (a) implementation must define behaviour of reading &
>  Jamie> writing dereferenced __norestrict pointers
> 
> [...] The standard could specify these reading/writing operations precisely
> in terms of other implementation-defined behavior; namely, the reading
> and writing of objects as arrays of char.  [...]  I think defining
> `norestrict' this way gives it the properties we want.

Even with GCC this doesn't have the expected properties...
Consider this on x86:

	#define __norestrict

	float f;
	long l = 0x7f800001;
	int main () {
		f = * (__norestrict float *) &l;
		printf ("%08x\n", * (__norestrict long *) &f);
	}

It prints "7fc00001".

If we were to define __norestrict accesses as equivalent to copying byte
arrays, it would print "7f800001" instead.

So you see with this definition, __norestrict implies more than just
changing the aliasing rules.

-- Jamie


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]