GCC 2.8.1 and egcs-2.91.57 bug.
Dar S. Efroni
efroni@emc.com
Thu Dec 3 16:32:00 GMT 1998
The following when compiled with -g -O2 and -g -O0 produces
two different outputs. (This is GCC 2.8.1 and egcs-2.91.57.)
// ---------------------------------------------------------------------
//
// g++ -o t -O2 -g t.C
// the output from the program is:
// 65
// 65
// g++ -o t -O0 -g t.C
// the output from the program is:
// 64
// 64
//
#include <iostream>
enum enumtype { value1 = 64, value2 = 65 };
bool function1( int i )
{
return i == 32;
}
enumtype function0( void )
{
int j;
int i;
enumtype savedErr = value2;
enumtype err = value1;
for (i = 0; i <= 1; i++)
{
bool st = function1( i );
cout << err << '\n';
if (st == false)
{
j = i;
}
else
{
err = value2;
}
}
return (err == value1) ? savedErr : err;
}
main()
{
function0();
}
//
// ---------------------------------------------------------------------
More information about the Gcc-bugs
mailing list