[Bug c/59850] Support sparse-style pointer address spaces (type attributes)
josh at joshtriplett dot org
gcc-bugzilla@gcc.gnu.org
Fri Jan 17 08:03:00 GMT 2014
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59850
Josh Triplett <josh at joshtriplett dot org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |josh at joshtriplett dot org
--- Comment #1 from Josh Triplett <josh at joshtriplett dot org> ---
A few additional behavior notes:
Casting a pointer from one address space to another must produce a warning,
unless the type used for the cast includes __attribute__((force)). (Typically,
a codebase will have safe ways to perform such conversions, wrapped up in
functions with appropriate parameter and return types, with a force'd cast in
them; for instance, the kernel's copy_to_user and copy_from_user functions.)
__attribute__((force)) can be used in the type of a function parameter as well,
in which case the caller can pass a pointer to a different address space
without complaint.
Dereferences of a noderef type inside a sizeof() or typeof() must not generate
warnings. For instance:
__attribute__((address_space(1),noderef)) int *a;
typeof(*a) b; /* b has type "int" */
typeof(*a) *c; /* c has type "int *" */
More information about the Gcc-bugs
mailing list