From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 2915 invoked by alias); 12 Jan 2014 00:28:49 -0000 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org Received: (qmail 2897 invoked by uid 48); 12 Jan 2014 00:28:45 -0000 From: "visenri at yahoo dot es" To: gcc-bugs@gcc.gnu.org Subject: [Bug c/59773] New: Mixing pointers to different memory spaces shows no warning (gcc for AVR) Date: Sun, 12 Jan 2014 00:28:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: c X-Bugzilla-Version: 4.7.2 X-Bugzilla-Keywords: X-Bugzilla-Severity: major X-Bugzilla-Who: visenri at yahoo dot es X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_id short_desc product version bug_status bug_severity priority component assigned_to reporter Message-ID: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-SW-Source: 2014-01/txt/msg01253.txt.bz2 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.