public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/13427] New: PGM string doesn't properly with strcpy variable index array
@ 2003-12-18  6:43 ken at realtronix dot net
  2003-12-18  6:47 ` [Bug c/13427] PGM string doesn't work properly with strcpy with " pinskia at gcc dot gnu dot org
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: ken at realtronix dot net @ 2003-12-18  6:43 UTC (permalink / raw)
  To: gcc-bugs

#include <avr/io.h>
#include <avr/pgmspace.h>
#include <string.h>

const char foo[] PROGMEM = "foo";
const char bar[] PROGMEM = "bar";

PGM_P  Langs[2] PROGMEM = {foo, bar};

int main(void)
{
  unsigned char i;
  char buf[2][5];
  
  //strcpy_P works fine with constant index
  strcpy_P(buf[0], Langs[0]);  //correctly copy 'foo'
  strcpy_P(buf[1], Langs[1]);  //correctly copy 'bar'
  
  //but strcpy_P copy char from wrong address if use variable indexing
  for (i=0; i<2; i++)
    strcpy_P(buf[i], Langs[i]);  //copy garbages!!!

  return 1;
}

-- 
           Summary: PGM string doesn't properly with strcpy variable index
                    array
           Product: gcc
           Version: 3.3.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: c
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: ken at realtronix dot net
                CC: gcc-bugs at gcc dot gnu dot org


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=13427


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug c/13427] PGM string doesn't work properly with strcpy with  variable index array
  2003-12-18  6:43 [Bug c/13427] New: PGM string doesn't properly with strcpy variable index array ken at realtronix dot net
@ 2003-12-18  6:47 ` pinskia at gcc dot gnu dot org
  2003-12-18  6:47 ` ken at realtronix dot net
  2003-12-18  8:02 ` pinskia at gcc dot gnu dot org
  2 siblings, 0 replies; 4+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2003-12-18  6:47 UTC (permalink / raw)
  To: gcc-bugs



-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
 GCC target triplet|                            |avr-elf


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=13427


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug c/13427] PGM string doesn't work properly with strcpy with  variable index array
  2003-12-18  6:43 [Bug c/13427] New: PGM string doesn't properly with strcpy variable index array ken at realtronix dot net
  2003-12-18  6:47 ` [Bug c/13427] PGM string doesn't work properly with strcpy with " pinskia at gcc dot gnu dot org
@ 2003-12-18  6:47 ` ken at realtronix dot net
  2003-12-18  8:02 ` pinskia at gcc dot gnu dot org
  2 siblings, 0 replies; 4+ messages in thread
From: ken at realtronix dot net @ 2003-12-18  6:47 UTC (permalink / raw)
  To: gcc-bugs



-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|PGM string doesn't properly |PGM string doesn't work
                   |with strcpy variable index  |properly with strcpy with
                   |array                       |variable index array


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=13427


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug c/13427] PGM string doesn't work properly with strcpy with  variable index array
  2003-12-18  6:43 [Bug c/13427] New: PGM string doesn't properly with strcpy variable index array ken at realtronix dot net
  2003-12-18  6:47 ` [Bug c/13427] PGM string doesn't work properly with strcpy with " pinskia at gcc dot gnu dot org
  2003-12-18  6:47 ` ken at realtronix dot net
@ 2003-12-18  8:02 ` pinskia at gcc dot gnu dot org
  2 siblings, 0 replies; 4+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2003-12-18  8:02 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2003-12-18 06:47 -------
This is a dup of bug 13428 which has more information.

*** This bug has been marked as a duplicate of 13428 ***

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|                            |DUPLICATE


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=13427


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2003-12-18  6:47 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-12-18  6:43 [Bug c/13427] New: PGM string doesn't properly with strcpy variable index array ken at realtronix dot net
2003-12-18  6:47 ` [Bug c/13427] PGM string doesn't work properly with strcpy with " pinskia at gcc dot gnu dot org
2003-12-18  6:47 ` ken at realtronix dot net
2003-12-18  8:02 ` pinskia at gcc dot gnu dot 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).