gnu/gcc/cbf217f4c7076d4e23a34735d403a192d4e78191 AVR: Add option for strict address space subset relations.
To date, each named address space is implemented as a subset
of all the other address spaces, which allows code like
char read_char (const char *addr, bool in_flash)
{
return in_flash
? *(const __flash char*) addr // Read from program memory.
: *addr; // Read from RAM.
}
even though __flash is not a subset of Generic.
This patch introduces new target option -mstrict-addr-space-subsets
which instructs avr_addr_space_subset_p to implement the address
space subset relations like they actually are, i.e.
__memx > __flashx > __flash, __flash1, ..., __flash5
__memx > Generic
gcc/
* config/avr/avr.opt (-mstrict-addr-space-subsets): New
target option.
* config/avr/avr.cc (avr_addr_space_subset_p): Use it.
* doc/invoke.texi (AVR Options): Document it.
3 files changed