[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#12375: marked as done ([Fix in {gcc,egcc}-2.91.x] gcc: -O2 produces bad code !)



Your message dated Thu, 12 Apr 2001 23:52:39 +0200 (MEST)
with message-id <15062.8940.590633.88211@bolero>
and subject line closing gcc272 bugs
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.)

Darren Benham
(administrator, Debian Bugs database)

--------------------------------------
Received: (at submit) by bugs.debian.org; 29 Aug 1997 21:07:51 +0000
Received: (qmail 18784 invoked from network); 29 Aug 1997 21:07:35 -0000
Received: from ppp-43.a2points.com (HELO bylbo.nowhere.earth) (dwitch@ppp-43.a2points.com@195.10.6.43)
  by 205.229.104.5 with SMTP; 29 Aug 1997 21:07:35 -0000
Received: (from dwitch@localhost)
	by bylbo.nowhere.earth (8.8.5/8.8.5) id XAA00813;
	Fri, 29 Aug 1997 23:10:45 +0200
Date: Fri, 29 Aug 1997 23:10:45 +0200
Message-Id: <199708292110.XAA00813@bylbo.nowhere.earth>
From: Yann Dirson <dwitch@monge.univ-mlv.fr>
To: submit@bugs.debian.org
Subject: gcc: -O2 produces bad code !
X-Mailer: VM 6.32 under Emacs 19.34.1
Reply-To: Yann Dirson <dirson@univ-mlv.fr>
Mime-Version: 1.0 (generated by tm-edit 7.106)
Content-Type: multipart/mixed;
 boundary="Multipart_Fri_Aug_29_23:10:17_1997-1"
Content-Transfer-Encoding: 7bit

--Multipart_Fri_Aug_29_23:10:17_1997-1
Content-Type: text/plain; charset=US-ASCII

Package: gcc
Version: 2.7.2.2-5

This bug should probably be forwarded upstream.

   -O2 optimization may cause erroneous code to be produced. Whether the bug
 is triggered is highly context-dependant, and the included bug.c is near
 minimal. The bug occurs on line 25 ("for..."); when suppressing lines
 immediately preceding/following this one, the bug doesn't show.
   What happens is that argv is incremented by 4, just as if "argv++" has
 been written.
   -O1 doesn't produce this behaviour, as demonstrated by the "showbug" script.


the bug was reproduced on 2 debian machines.
debian versions of software used:

  gcc		2.7.2.1-2	2.7.2.2-5
  libc5		5.4.33-3	N/A
  libc6		N/A		2.0.4-1
  binutils	2.7-3		2.8.1-1
  ldso		1.8.5-1		1.9.2-1

Fortunately, it seems easy to reproduce


attached files are:

	bug.c		small C program influenced by the bug
	.gdbinit	gdb script running the program and displaying
			 influenced data
	showbug		sh script showing the bug

-- 
Yann Dirson <dirson@univ-mlv.fr>
alt-email:<ydirson@a2points.com>

http://monge.univ-mlv.fr/~dirson

--Multipart_Fri_Aug_29_23:10:17_1997-1
Content-Type: application/octet-stream
Content-Disposition: attachment; filename="bug.c"
Content-Transfer-Encoding: 7bit

#include <errno.h>
#include <stdio.h>
#include <sys/kd.h>
#include <fcntl.h>
#include <sys/ioctl.h>
#include <unistd.h>

#define VERSION "1"

char *progname;
int verbose = 0;

int getfd() {
    return 0;
}

int main(int argc, char *argv[])
{
  int fd, i;

  progname = argv[0];

  fd = getfd();

  for (i = 1; i < argc; i++) 
    {
      if (!strcmp(argv[i], "-V")) 
	  printf("%s version %s\n", progname, VERSION);
      else if (!strcmp(argv[i], "-v")) 
	  verbose = 1;
    }

	return 0;
}

--Multipart_Fri_Aug_29_23:10:17_1997-1
Content-Type: application/octet-stream
Content-Disposition: attachment; filename=".gdbinit"
Content-Transfer-Encoding: 7bit

list 25
break 25
run an_arg
echo argv is:
print argv
next
echo argv is:
print argv
quit

--Multipart_Fri_Aug_29_23:10:17_1997-1
Content-Type: application/octet-stream
Content-Disposition: attachment; filename="showbug"
Content-Transfer-Encoding: 7bit

#!/bin/sh

echo 'Compiling demos...'

gcc -g -O1 bug.c -o bugO1
gcc -g -O2 bug.c -o bugO2

echo 'Showing correct results (-O1)...'
gdb bugO1

echo 'Showing buggy results (-O2)...'
gdb bugO2

--Multipart_Fri_Aug_29_23:10:17_1997-1--
---------------------------------------
Received: (at 12375-done) by bugs.debian.org; 12 Apr 2001 21:58:24 +0000
>From doko@cs.tu-berlin.de Thu Apr 12 16:58:24 2001
Return-path: <doko@cs.tu-berlin.de>
Received: from mail.cs.tu-berlin.de [130.149.17.13] (root)
	by master.debian.org with esmtp (Exim 3.12 1 (Debian))
	id 14np6d-0003Xr-00; Thu, 12 Apr 2001 16:58:24 -0500
Received: from bolero.cs.tu-berlin.de (bolero.cs.tu-berlin.de [130.149.19.1])
	by mail.cs.tu-berlin.de (8.9.3/8.9.3) with ESMTP id XAA08192;
	Thu, 12 Apr 2001 23:53:09 +0200 (MET DST)
Received: (from doko@localhost)
	by bolero.cs.tu-berlin.de (8.9.3+Sun/8.9.3) id XAA19323;
	Thu, 12 Apr 2001 23:52:39 +0200 (MEST)
From: Matthias Klose <doko@cs.tu-berlin.de>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Date: Thu, 12 Apr 2001 23:52:39 +0200 (MEST)
To: 4429-done@bugs.debian.org, 4430-done@bugs.debian.org,
        4954-done@bugs.debian.org, 5367-done@bugs.debian.org,
        6047-done@bugs.debian.org, 12375-done@bugs.debian.org,
        20606-done@bugs.debian.org, 20889-done@bugs.debian.org,
        24788-done@bugs.debian.org, 26100-done@bugs.debian.org,
        34322-done@bugs.debian.org, 48726-done@bugs.debian.org,
        54544-done@bugs.debian.org, 63154-done@bugs.debian.org
Subject: closing gcc272 bugs
X-Mailer: VM 6.43 under 20.4 "Emerald" XEmacs  Lucid
Message-ID: <15062.8940.590633.88211@bolero>
Delivered-To: 12375-done@bugs.debian.org

gcc272 (2.7.2.3-18) unstable; urgency=low

  * Close all gcc272 in the Debian bug tracking archive. The use of
    gcc272 is deprecated. The only reason it exists is to have a
    compiler for the linux kernel 2.0.x.
    The bug reports for gcc272 are still available on
    http://bugs.debian.org/cgi-bin/pkgreport.cgi?pkg=gcc272&archive=yes
    Closes: #4429, #4430, 4954, #5367, #6047, #12375, #20606, #20889,
    #24788, #26100, #34322, #48726, #54544, #63154.



Reply to: