Invalid conversion between named address space pointers - pointer assignment
0 reputation · 02 Sept 2020, 10:17 UTC
A design goal is to place infrequently accessed data in a named address space mapped to cheaper memory to reduce BOM and runtime power for a low-traffic workload. Embedded C named address spaces require distinct pointer types, and an implicit assignment from a named address space qualified pointer to a generic pointer is a constraint violation.
The constraint is documented for compliant compilers, where the conversion is diagnosed as invalid conversion between named address space pointers unless an explicit cast is used. This affects code that moves data between address spaces and any interface that expects plain pointers.
The specification leaves the behavior of standard library functions with named address space pointers unresolved. It is not defined how functions such as memcpy, memmove, or strcpy handle source and destination pointers that carry named address space qualifiers.
What is the defined requirement for pointer conversions between named address spaces and generic pointers in Embedded C? Does the standard require implementations to diagnose or reject calls to standard library functions when arguments are named address space pointers? Which implementations define the behavior for mixed address space copies, and how is portability assessed?