From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 13906 invoked by alias); 29 Jan 2014 09:54:48 -0000 Mailing-List: contact ecos-bugs-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Post: List-Help: , Sender: ecos-bugs-owner@sourceware.org Received: (qmail 13890 invoked by uid 89); 29 Jan 2014 09:54:46 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.8 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_LOW,RP_MATCHES_RCVD,SPF_PASS autolearn=ham version=3.3.2 X-HELO: mail.ecoscentric.com Received: from hagrid.ecoscentric.com (HELO mail.ecoscentric.com) (212.13.207.197) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-SHA encrypted) ESMTPS; Wed, 29 Jan 2014 09:54:45 +0000 Received: by mail.ecoscentric.com (Postfix, from userid 48) id D677C4680001; Wed, 29 Jan 2014 09:54:41 +0000 (GMT) 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 X-Bugzilla-Reason: AssignedTo X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: eCos X-Bugzilla-Component: Gnutools X-Bugzilla-Keywords: X-Bugzilla-Severity: critical X-Bugzilla-Who: J.Lambrecht@televic.com X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Priority: low X-Bugzilla-Assigned-To: unassigned@bugs.ecos.sourceware.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Changed-Fields: bug_id short_desc product version rep_platform op_sys 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://bugs.ecos.sourceware.org/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-SW-Source: 2014/txt/msg00039.txt.bz2 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.