public inbox for ecos-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug 1001934] New: gcc 4.6.3-20120623 optimizes wrong
@ 2014-01-29  9:54 bugzilla-daemon
  2014-02-18 12:45 ` [Bug 1001934] " bugzilla-daemon
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: bugzilla-daemon @ 2014-01-29  9:54 UTC (permalink / raw)
  To: unassigned

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.


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

end of thread, other threads:[~2014-02-26 13:58 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-01-29  9:54 [Bug 1001934] New: gcc 4.6.3-20120623 optimizes wrong bugzilla-daemon
2014-02-18 12:45 ` [Bug 1001934] " bugzilla-daemon
2014-02-19  0:07 ` bugzilla-daemon
2014-02-26 13:58 ` bugzilla-daemon

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).