public inbox for ecos-bugs@sourceware.org
help / color / mirror / Atom feed
From: bugzilla-daemon@bugs.ecos.sourceware.org
To: unassigned@bugs.ecos.sourceware.org
Subject: [Bug 1001934] New: gcc 4.6.3-20120623 optimizes wrong
Date: Wed, 29 Jan 2014 09:54:00 -0000	[thread overview]
Message-ID: <bug-1001934-777@http.bugs.ecos.sourceware.org/> (raw)

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.


             reply	other threads:[~2014-01-29  9:54 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-01-29  9:54 bugzilla-daemon [this message]
2014-02-18 12:45 ` [Bug 1001934] " bugzilla-daemon
2014-02-19  0:07 ` bugzilla-daemon
2014-02-26 13:58 ` bugzilla-daemon

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-1001934-777@http.bugs.ecos.sourceware.org/ \
    --to=bugzilla-daemon@bugs.ecos.sourceware.org \
    --cc=unassigned@bugs.ecos.sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).