Bug Report for EGCS 2.91.66

Rajat Todi todi@scl.ameslab.gov
Mon Jul 5 15:39:00 GMT 1999


Hi,

Here is the bug which I found in the latest version of gcc version
egcs 2.91.66. 

Here is the extracted program. I have taken out problem part out
of the bigger code (PABLO from UIUC research).

// main.C
#
#
#include <stream.h>
#include <stdlib.h>
#include <string.h>
#include <values.h>


main( int argc, char **argv ) {

	enum Status       { INVALID, VALID };
	Status 		     inputFileStatus;

	int pktCount = 0;

	while(1) {

		if ( ( ++pktCount % 1000 ) == 0 ) {
			cerr << pktCount << "... ";
			cerr.flush();
		}
	}

}

// end of main.C
------------------------------------------------------------------
SUMMARY OF THE BUG

Note that the reason this program is failing is because the 
Status datatype has been defined inside the main(). It 
take Status outside the main(), compilation is okay. 

In my opinion, current C++ standard does not restrict the 
definition of enum type to be global. I guess this is a bug.
AGAIN we have a get around...that is to move the enum
defination outside the main() and so if you put it in your
bug list it would be fine.

EXTREMELY PECULIAR BEHAVIOR: 
NOTE THAT THIS ONLY HAPPENS WITH THE OPERATOR % or / . 
i.e. if you take the while loop out and insert some other
statement it will work. I HAVE NO CLUE WHY....


--------------------------------------------------------------------
RUN RESULT:

Operating System$ uname -a Linux doormouse.alice.scl.ameslab.gov
2.2.10 #3 SMP Thu Jul 1 03:29:37 CDT 1999 i686 unknown

Compilter: gcc version egcs-2.91.66

Program: main.C /usr/bin/g++ -v --save-temps -o FileStats -O main.C
Reading specs from /usr/lib/gcc-lib/i386-redhat-linux/egcs-2.91.66/specs
gcc version egcs-2.91.66 19990314/Linux (egcs-1.1.2 release) 
 /usr/lib/gcc-lib/i386-redhat-linux/egcs-2.91.66/cpp -lang-c++ -v -undef
-D__GNUC__=2 -D__GNUG__=2 -D__cplusplus -D__GNUC_MINOR__=91 -D__ELF__
-Dunix -Di386 -D__i386__ -Dlinux -D__ELF__ -D__unix__ -D__i386__
-D__i386__ -D__linux__ -D__unix -D__i386 -D__linux -Asystem(posix)
-D__EXCEPTIONS -D__OPTIMIZE__ -Asystem(unix) -Acpu(i386) -Amachine(i386)
-Di386 -D__i386 -D__i386__ main.C main.ii GNU CPP version egcs-2.91.66
19990314/Linux (egcs-1.1.2 release) (i386 Linux/ELF) #include "..." search
starts here: #include <...> search starts here: 
 /usr/include/g++-2
 /usr/i386-redhat-linux/include
 /usr/lib/gcc-lib/i386-redhat-linux/egcs-2.91.66/include
 /usr/include End of search list. 
 /usr/lib/gcc-lib/i386-redhat-linux/egcs-2.91.66/cc1plus main.ii -quiet
-dumpbase main.cc -O -version -o main.s GNU C++ version egcs-2.91.66
19990314/Linux (egcs-1.1.2 release)  (i386-redhat-linux) compiled by GNU C
version egcs-2.91.66 19990314/Linux (egcs-1.1.2 release). main.C: In
function `int main(int, char **)': main.C:23: Internal compiler error. 
main.C:23: Please submit a full bug report to `egcs-bugs@egcs.cygnus.com'.
main.C:23: See <URL: http://egcs.cygnus.com/faq.html#bugreport > for
details. [todi@doormouse Build]$ pwd
/home/todi/pablo/Pablo/SDDF/Programs/SDDF/Build [todi@doormouse Build]$
uname -a Linux doormouse.alice.scl.ameslab.gov 2.2.10 #3 SMP Thu Jul 1
03:29:37 CDT 1999 i686 unknown

-----------------------------------------------------------------------

Same program on older OS with NO BUG

Operating System: Linux o 2.0.28 #6 Sat Feb 22 01:56:36 CST 1997 i686

Compiler: gcc version 2.7.2

o~/tmp/pablo%/usr/bin/g++ -v --save-temps -o FileStats -O main.C
 /usr/bin/gcc -v --save-temps -o FileStats -O main.C -lg++ -lstdc++ -lm
Reading specs from /usr/lib/gcc-lib/i486-linux/2.7.2/specs gcc version
2.7.2
 /usr/lib/gcc-lib/i486-linux/2.7.2/cpp -lang-c++ -v -undef -D__GNUC__=2
-D__GNUG__=2 -D__cplusplus -D__GNUC_MINOR__=7 -D__ELF__ -Dunix -Di386
-Dlinux -D__ELF__ -D__unix__ -D__i386__ -D__linux__ -D__unix -D__i386
-D__linux -Asystem(unix) -Asystem(posix) -Acpu(i386) -Amachine(i386)
-D__OPTIMIZE__ -D__i486__ main.C main.ii GNU CPP version 2.7.2 (i386
Linux/ELF) #include "..." search starts here: #include <...> search starts
here: 
 /usr/include/g++
 /usr/local/include
 /usr/i486-linux/include
 /usr/lib/gcc-lib/i486-linux/2.7.2/include
 /usr/include End of search list. 
 /usr/lib/gcc-lib/i486-linux/2.7.2/cc1plus main.ii -m486 -malign-loops=2
-malign-jumps=2 -malign-functions=2 -m486 -malign-loops=2 -malign-jumps=2
-malign-functions=2 -quiet -dumpbase main.cc -O -version -o main.s GNU C++
version 2.7.2 (i386 Linux/ELF) compiled by GNU C version 2.7.2. 
 /usr/i486-linux/bin/as -V -Qy -o main.o main.s GNU assembler version
960425 (i486-linux), using BFD version 2.6.0.14
 /usr/i486-linux/bin/ld -m elf_i386 -dynamic-linker /lib/ld-linux.so.1 -o
FileStats /usr/lib/crt1.o /usr/lib/crti.o /usr/lib/crtbegin.o
-L/usr/lib/gcc-lib/i486-linux/2.7.2 -L/usr/i486-linux/lib main.o -lg++
-lstdc++ -lm -lgcc -lc -lgcc /usr/lib/crtend.o /usr/lib/crtn.o
o~/tmp/pablo%ls FileStats* main.C main.ii main.o main.s
-----------------------------------------------------------------------


Please let me know if you want any more detail if you are not
able to reproduce the bug.

I take this opportunity to thank you all for the great work. I hope
we are able to see more optimized version for latest processors.

May the force be with you.

Rajat Todi
todi@acm.org
Scalable Computing Laboratory,
Ames Laboratory,
237 Wilhelm, ISU, Ames, IA 50011-3020 
Phone:  (515)-294-1918
Mobile: (515)-441-0370 (with voicemail)
Fax: (515)-294-4491





More information about the Gcc-bugs mailing list