This is the mail archive of the ecos-bugs@sourceware.org mailing list for the eCos project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug 1001934] New: gcc 4.6.3-20120623 optimizes wrong


Please do not reply to this email, use the link below.

http://bugs.ecos.sourceware.org/show_bug.cgi?id=1001934

            Bug ID: 1001934
           Summary: gcc 4.6.3-20120623 optimizes wrong
           Product: eCos
           Version: CVS
            Target: at91 (Atmel evaluation board (EB40))
  Architecture/Host HostOS: Linux
                OS:
            Status: UNCONFIRMED
          Severity: critical
          Priority: low
         Component: Gnutools
          Assignee: unassigned@bugs.ecos.sourceware.org
          Reporter: J.Lambrecht@televic.com

arm-eabi-gcc (eCos GNU Tools 4.6.3-20120623) 4.6.3 contains a bug: it optimizes
too much in televic-application-code.c (see comment in code):

static TLV_CHAR szConfigVersion[MAX_TOKLEN + 1U];
static TLV_CHAR szConfigArtNr[MAX_TOKLEN + 1U];

TLV_U32 TeLeVic_function(TLV_CHAR *p_String)
{
  TLV_CHAR attribute[MAX_TOKLEN + 1U];
  TLV_CHAR value[MAX_TOKLEN + 1U];
  TLV_S32 s32_valueInt;

  szConfigVersion[0] = 0;
  szConfigArtNr[0] = 0;

...

  if (...)
  {
...
  }
  else
  {
    while (GetAttribute(attribute, &s32_valueInt, value) == TOK_ATTRIBUTE)
    {
      if (strcmp(attribute, "version") == 0)
      {
        strncpy(szConfigVersion, value, sizeof(szConfigVersion));
        szConfigVersion[sizeof(szConfigVersion)] = 0;
/* In this printf szConfigVersion is correct:
     printf("value=%s, szConfigVersion=%s\n", value, szConfigVersion); */
      }
      else if (strcmp(attribute, "artnr") == 0)
      {
        strncpy(szConfigArtNr, value, sizeof(szConfigArtNr));
        szConfigArtNr[sizeof(szConfigArtNr)] = 0;
/* WARNING: in this printf szConfigVersion is 0 with the eabi compiler; with
the
   elf compiler it is OK!!!
     printf("value=%s, szConfigVersion=%s\n", value, szConfigVersion); */
      }

    }
    Enter();
  }
-------------------------------------------
So identically the same code (application+ecos) compiled with arm-elf-gcc (GCC)
3.2.1 (eCosCentric) works fine.
With or without printf's, the result is the same.

-- 
You are receiving this mail because:
You are the assignee for the bug.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]