I have reviewed the gcc web page for reporting bugs and this situation is not covered.
I have a program that I have been compiling with the gcc 2.9 and 3.4 series. In the past week I upgraded to gcc 4.0.0 I compiled the program and corrected the warning message about using "unsigned char *" when the function prototype specified "char *" and vice versa. The program files are compiled with the following command line in the make file: gcc -O3 -std=c99 -Wunused-variable -o $@ -lm $(OBJS) There is no compiler output beyond reporting the command line invocation. No warning messages, no compiler errors of any kind. The program has run for many years with no problem. Under gcc 4.0.0, I get a memory access error. If I change the compile command in the make file to: gcc -g -std=c99 -Wunused-variable -o $@ -lm $(OBJS) The program runs with no error. Changing the optimization option to "O" and compiling and the program again runs with no error. Only when I compile with an optimization level of "O2" or "O3" does the program exit with a memory access error. I have attempted to compile with "-g -O3" or "-g -O2" flags and then run under Kdebug. This fails with an error message from Kdebug that gdb failed to load the program. Thus, I am totally unable to debug the program and find the exact problem with the optimization. Thus, there appears to be a fatal error in the "O2" and "O3" levels of optimization in gcc and a definite error in the debug output when the O2 or O3 optimization level is specified. compiler output below: gcc -O3 -save-temps -std=c99 -Wunused-variable -c -o pipes.o pipes.c gcc -O3 -save-temps -std=c99 -Wunused-variable -c -o awkpact.o awkpact.c gcc -O3 -save-temps -std=c99 -Wunused-variable -c -o awkpcmp.o awkpcmp.c gcc -O3 -save-temps -std=c99 -Wunused-variable -c -o awkpdo.o awkpdo.c gcc -O3 -save-temps -std=c99 -Wunused-variable -c -o awkpfun.o awkpfun.c gcc -O3 -save-temps -std=c99 -Wunused-variable -c -o awkplus.o awkplus.c gcc -O3 -save-temps -std=c99 -Wunused-variable -c -o awkpmsc.o awkpmsc.c gcc -O3 -save-temps -std=c99 -Wunused-variable -c -o awkprd.o awkprd.c gcc -O3 -save-temps -std=c99 -Wunused-variable -c -o awkpwrt.o awkpwrt.c gcc -O3 -save-temps -std=c99 -Wunused-variable -c -o date.o date.c gcc -O3 -save-temps -std=c99 -Wunused-variable -c -o filefuncs.o filefuncs.c linking gcc -o qtawk -lm pipes.o qtawkcpy.o awkpact.o awkpcmp.o awkpdo.o awkpfun.o awkplus.o awkpmsc.o awkprd.o awkpwrt.o date.o filefuncs.o getopt.o compile_routines_short.o scan_routines.o I have the "*.i" files as a tarred and bzip2 compressed file - need to know where to send the file. -- Summary: O2 and O3 memory access error - compiled program - incorrect debug output Product: gcc Version: 4.0.0 Status: UNCONFIRMED Severity: critical Priority: P2 Component: c AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: fastsnip-gcc at yahoo dot com CC: gcc-bugs at gcc dot gnu dot org http://gcc.gnu.org/bugzilla/show_bug.cgi?id=21322