[EGCS 2.96, 2000/01/31 snapshot, i586, gcc] Bad assembly code

Marco Goetze gomar@mindless.com
Wed Feb 2 03:22:00 GMT 2000


This bug report is meant to correct another one issued by me (Message-
ID: <20000118122158.B12913@c241-1.fem.tu-ilmenau.de>), in which I drew 
wrong conclusions as to which circumstances the error occurs in.  
Following are a different description and a program reliably 
reproducing the error (for me, anyway).

I came across the error reproduced by the attached program by chasing
some weird anomaly in Mutt, an MUA.  It shows in that, in certain
circumstances, one and the same (VAR & CONST) expression is evaluated
differently, for certain values of VAR and CONST, if optimization is
either 1 or 2 ("-O0" and "-O3" upward don't exhibit this effect).

Anyway, the program should print "FALSE" twice, but when compiled with
"-O1" or "-O2", prints "FALSE" and "TRUE" (in this order).  Again, the
command line used to compile the program was:

  gcc -O2 -o bug bug.c

Though I can't say for sure, I'd suspect the same bug to have been
responsible for the same effect (Mutt segfaulted) with previous
snapshots of EGCS (1999-11-10 compiled it correctly, however).


  OS:             Linux 2.3.40
  compiler:       EGCS 2.96, 2000/01/31 snapshot
  compiler setup: native i586-pc-linux-gnu, configure switches:
                    --enable-shared --prefix=/usr
  glibc version:  2.1.2


More information about the Gcc-bugs mailing list