[Bug c/59850] Support sparse-style pointer address spaces (type attributes)

tromey at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Wed Feb 5 14:45:00 GMT 2014


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59850

--- Comment #6 from Tom Tromey <tromey at gcc dot gnu.org> ---
Null pointer constants are treated specially, which makes sense,
but only if they have type "void *" and are in address space 0.
That is, this works:

#define NULL ((__attribute__ ((address_space (0))) void *) 0)
__attribute__((address_space (1))) int *p = NULL;

But this gets a warning:

#define NULL ((__attribute__ ((address_space (1))) void *) 0)
__attribute__((address_space (0))) int *p = NULL;

And so does this:

#define NULL ((int *) 0)
__attribute__((address_space (1))) int *p = NULL;


I'm not sure whether that last one ought to be an error or not.



More information about the Gcc-bugs mailing list