http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59773
Bug ID: 59773 Summary: Mixing pointers to different memory spaces shows no warning (gcc for AVR) Product: gcc Version: 4.7.2 Status: UNCONFIRMED Severity: major Priority: P3 Component: c Assignee: unassigned at gcc dot gnu.org Reporter: visenri at yahoo dot es I'll explain it with an example. Having these strings declared: const char __flash strF[] = "Flash"; const char strR[] = "RAM"; And a function with a 24 bit flat pointer like this: Foo( const char __memx * str ); Calling it like this is ok (16 bit pointer is enlarged to 24 generating correct code): Foo(strF); Foo(strR); But using functions with 16 bit pointer: FooR( const char * str ); //16 bit pointer to RAM FooF( const char _flash * str ); //16 bit pointer to FLASH And these variables: const char __memx * pstr; const char * pstrR; const char __flash * pstrF; These lines should show at least a warning: FooR(strF); // same size, different memory space FooF(strR); // same size, different memory space FooR(pstr); // pstr is 24 bit, bigger than 16 bit ram pointer in function FooF(pstr); // pstr is 24 bit, bigger than 16 bit flash pointer in function pstrR = strF; // same size, different memory space pstrF = strR; // same size, different memory space pstrR = pstr; // pstr is 24 bit, bigger than 16 bit ram pointer pstrF = pstr; // pstr is 24 bit, bigger than 16 bit flash pointer Because we are going to use a ROM/FLASH pointer as a RAM pointer or the other way.