more, re painful optimization bug in 19980921

Corey Kosak kosak@cs.cmu.edu
Sun Sep 27 13:50:00 GMT 1998


Sorry for the second email but I have a simpler, template-free version of the
program that exhibits the same error (maybe this simplifies debugging?).  Also
I want to point out that the same problem exists on egcs-1.1b and gcc-2.8.1


% cat pp5.cc
#include <stdio.h>

int main()
{
  int n=1000;

  printf("%d\n", n);
  for(int i=0; i<1; ++i) {
    printf("%d\n", n);
    n=666;
    (int&)n;
  }
}


% g++ -v && g++ -O pp5.cc && a.out
Reading specs from /afs/cs.cmu.edu/project/cmcl-kosak/various-gcc/egcs-19980921/i386_linux2/lib/gcc-lib/i686-pc-linux-gnulibc1/egcs-2.92.11/specs
gcc version egcs-2.92.11 19980921 (gcc2 ss-980609 experimental)
1000
666

% ~/ko/various-gcc/egcs-latest-release/i386_linux2/bin/g++ -v && ~/ko/various-gcc/egcs-latest-release/i386_linux2/bin/g++ -O pp5.cc && a.out
Reading specs from /afs/cs.cmu.edu/project/cmcl-kosak/various-gcc/egcs-1.1b/i386_linux2/lib/gcc-lib/i686-pc-linux-gnulibc1/egcs-2.91.57/specs
gcc version egcs-2.91.57 19980901 (egcs-1.1 release)
1000
666

% ~/281local/bin/g++ -v && ~/281local/bin/g++ -O pp5.cc && a.out
Reading specs from /home/kosak/281local/lib/gcc-lib/i686-pc-linux-gnulibc1/2.8.1/specs
gcc version 2.8.1
1000
666



More information about the Gcc-bugs mailing list