Your message dated Sun, 6 Jul 2003 11:54:54 +0200 with message-id <[EMAIL PROTECTED]> and subject line Bug#179712: gcc-3.2 -O2 miscompilation (i386) has caused the attached Bug report to be marked as done.
This means that you claim that the problem has been dealt with. If this is not the case it is now your responsibility to reopen the Bug report if necessary, and/or fix the problem forthwith. (NB: If you are a system administrator and have no idea what I am talking about this indicates a serious mail system misconfiguration somewhere. Please contact me immediately.) Debian bug tracking system administrator (administrator, Debian Bugs database) -------------------------------------- Received: (at submit) by bugs.debian.org; 4 Feb 2003 03:02:12 +0000 >From marko@l-t.ee Mon Feb 03 21:02:12 2003 Return-path: <marko@l-t.ee> Received: from pc200.host8.starman.ee (snoopy.l-t.ee) [62.65.200.200] by master.debian.org with esmtp (Exim 3.12 1 (Debian)) id 18ftLg-0002IW-00; Mon, 03 Feb 2003 21:02:12 -0600 Received: by snoopy.l-t.ee (Postfix, from userid 1000) id AC6AD15182; Tue, 4 Feb 2003 05:02:10 +0200 (EET) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: Marko Kreen <marko@l-t.ee> To: Debian Bug Tracking System <[EMAIL PROTECTED]> Subject: gcc-3.2 -O2 miscompilation (i386) X-Mailer: reportbug 2.10 Date: Tue, 04 Feb 2003 05:02:10 +0200 Message-Id: <[EMAIL PROTECTED]> Delivered-To: [EMAIL PROTECTED] X-Spam-Status: No, hits=0.6 required=5.0 tests=SPAM_PHRASE_00_01 version=2.41 X-Spam-Level: Package: gcc-3.2 Version: 1:3.2.2-0pre8 Severity: normal gcc-3.2 -O2 miscompiles following program: --------------------------------------------- extern int write(int fd, void *buf, int len); extern int toupper(int c); void strupr (char *s) { while (*s) *s++ = toupper(*s); } int main(int argc, char *argv[]) { char s[] = "foo"; strupr(s); write(1, s, 3); write(1, "\n", 1); return 0; } --------------------------------------------- $ gcc-3.2 -Wall -O2 -o test test.c test.c: In function `strupr': test.c:7: warning: operation on `s' may be undefined $ ./test OO $ --------------------------------------------- gcc-2.95 compiles it correctly, also gcc-3.2 when optimizing less than -O2. When the "toupper(*s)" is replaced with "*s & 0x5f" gcc-3.2 -O2 also works and without warning. found the error when tried to compile glheretic. -- System Information: Debian Release: testing/unstable Architecture: i386 Kernel: Linux snoopy 2.4.20 #1 SMP Mon Jan 13 17:12:00 EET 2003 i686 Locale: LANG=C, LC_CTYPE=C Versions of packages gcc-3.2 depends on: ii binutils 2.13.90.0.16-1 The GNU assembler, linker and bina ii cpp-3.2 1:3.2.2-0pre8 The GNU C preprocessor ii gcc-3.2-base 1:3.2.2-0pre8 The GNU Compiler Collection (base ii libc6 2.3.1-10 GNU C Library: Shared libraries an ii libgcc1 1:3.2.2-0pre8 GCC support library -- no debconf information --------------------------------------- Received: (at 179712-done) by bugs.debian.org; 6 Jul 2003 09:55:38 +0000 >From [EMAIL PROTECTED] Sun Jul 06 04:55:36 2003 Return-path: <[EMAIL PROTECTED]> Received: from mail.cs.tu-berlin.de [130.149.17.13] by master.debian.org with esmtp (Exim 3.35 1 (Debian)) id 19Z6F6-0005gS-00; Sun, 06 Jul 2003 04:55:36 -0500 Received: from bolero.cs.tu-berlin.de ([EMAIL PROTECTED] [130.149.19.1]) by mail.cs.tu-berlin.de (8.9.3/8.9.3) with ESMTP id LAA02899; Sun, 6 Jul 2003 11:54:54 +0200 (MET DST) Received: (from [EMAIL PROTECTED]) by bolero.cs.tu-berlin.de (8.11.6+Sun/8.9.3) id h669ssh19516; Sun, 6 Jul 2003 11:54:54 +0200 (MEST) From: Matthias Klose <[EMAIL PROTECTED]> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Message-ID: <[EMAIL PROTECTED]> Date: Sun, 6 Jul 2003 11:54:54 +0200 To: Daniel Jacobowitz <[EMAIL PROTECTED]>, [EMAIL PROTECTED] Cc: Marko Kreen <marko@l-t.ee> Subject: Re: Bug#179712: gcc-3.2 -O2 miscompilation (i386) In-Reply-To: <[EMAIL PROTECTED]> References: <[EMAIL PROTECTED]> <[EMAIL PROTECTED]> X-Mailer: VM 7.03 under 21.4 (patch 6) "Common Lisp" XEmacs Lucid Delivered-To: [EMAIL PROTECTED] X-Spam-Status: No, hits=-14.5 required=4.0 tests=BAYES_30,EMAIL_ATTRIBUTION,IN_REP_TO,QUOTED_EMAIL_TEXT, REFERENCES,REPLY_WITH_QUOTES,USER_AGENT_VM autolearn=ham version=2.53-bugs.debian.org_2003_06_27 X-Spam-Level: X-Spam-Checker-Version: SpamAssassin 2.53-bugs.debian.org_2003_06_27 (1.174.2.15-2003-03-30-exp) Daniel Jacobowitz writes: > On Tue, Feb 04, 2003 at 05:02:10AM +0200, Marko Kreen wrote: > > Package: gcc-3.2 > > Version: 1:3.2.2-0pre8 > > Severity: normal > > > > > > gcc-3.2 -O2 miscompiles following program: > > > > --------------------------------------------- > > extern int write(int fd, void *buf, int len); > > extern int toupper(int c); > > > > void strupr (char *s) > > { > > while (*s) > > *s++ = toupper(*s); > > } > > > > int main(int argc, char *argv[]) > > { > > char s[] = "foo"; > > strupr(s); > > write(1, s, 3); > > write(1, "\n", 1); > > return 0; > > } > > > > --------------------------------------------- > > $ gcc-3.2 -Wall -O2 -o test test.c > > test.c: In function `strupr': > > test.c:7: warning: operation on `s' may be undefined > > $ ./test > > OO > > $ > > --------------------------------------------- > > > > gcc-2.95 compiles it correctly, also gcc-3.2 when optimizing > > less than -O2. When the "toupper(*s)" is replaced with "*s & 0x5f" > > gcc-3.2 -O2 also works and without warning. > > I think the lack of warning in that case is actually the bug, but I'm > not sure. C doesn't guarantee order-of-operation across an equals > sign; it's not a sequence point. The function call is a sequence point > but it isn't specified which side of the sequence point the increment > will happen on. closing the report. the warning is printed by the default gcc (3.3) in our current testing/unstable distribution.