public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/59773] New: Mixing pointers to different memory spaces shows no warning (gcc for AVR)
@ 2014-01-12 0:28 visenri at yahoo dot es
2014-01-15 13:56 ` [Bug target/59773] " gjl at gcc dot gnu.org
0 siblings, 1 reply; 2+ messages in thread
From: visenri at yahoo dot es @ 2014-01-12 0:28 UTC (permalink / raw)
To: gcc-bugs
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.
^ permalink raw reply [flat|nested] 2+ messages in thread
* [Bug target/59773] Mixing pointers to different memory spaces shows no warning (gcc for AVR)
2014-01-12 0:28 [Bug c/59773] New: Mixing pointers to different memory spaces shows no warning (gcc for AVR) visenri at yahoo dot es
@ 2014-01-15 13:56 ` gjl at gcc dot gnu.org
0 siblings, 0 replies; 2+ messages in thread
From: gjl at gcc dot gnu.org @ 2014-01-15 13:56 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59773
Georg-Johann Lay <gjl at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Target| |avr
Priority|P3 |P5
Status|UNCONFIRMED |RESOLVED
Component|c |target
Resolution|--- |INVALID
Severity|major |normal
--- Comment #1 from Georg-Johann Lay <gjl at gcc dot gnu.org> ---
Please use the -Waddr-space-convert option available for avr-gcc, cf. PR56263
available in 4.8.0 and newer.
Because PR56263 is neither a documentation fix nor a bug, it won't be
backported to 4.7 according to GCC's porting pilicies.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2014-01-15 13:56 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-01-12 0:28 [Bug c/59773] New: Mixing pointers to different memory spaces shows no warning (gcc for AVR) visenri at yahoo dot es
2014-01-15 13:56 ` [Bug target/59773] " gjl at gcc dot gnu.org
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).