There is a problem under Windows (Mingw) when using gcc-3.x sources. This problem came up under the last alpha as well. I am using gcc-3.2.1 sources (but it was also there under gcc-3.1.1).
This is the scenario:
1. Build GPC with these CFLAGS: "-O2 -g -march=i486 -mcpu=i686 -fomit-frame-pointer" (the real culprit seems to be "-fomit-frame-pointer" - but it also needs the cpu switches - if you remove either the cpu switches or "-fomit-frame-pointer", then the problem doesn't occur). The "-g" switch is not significant - the problem is the same with or without it.
2. compile the following program (whether with "-g0" or "-g" or "-gstabs" or without any debugging info): program bug2; var f : text; begin assign (f, 'foo.txt'); rewrite (f); writeln (f, 'OK'); close (f); end.
3. run the program:
4. You get an almight crash, and this report from gdb:
C:\usr\test>gdb bug2.exe GNU gdb 5.2.1 Copyright 2002 Free Software Foundation, Inc. GDB is free software, covered by the GNU General Public License, and you are welcome to change it and/or distribute copies of it under certain conditions. Type "show copying" to see the conditions. There is absolutely no warranty for GDB. Type "show warranty" for details. This GDB was configured as "mingw32"... (gdb) run Starting program: C:\usr\test/bug2.exe
Program received signal SIGSEGV, Segmentation fault. $00410f19 in _p_assign (T=@$0, Name=@$0) at d:/src/gcc-3.2.1/gcc/p/rts/files.pas:148 148 B.Name := Name; Current language: auto; currently pascal
5. By the same token, many programs in the test suite result in the same almighty crash, so the test suite is unrunnable. Now the "-fomit-frame-pointer" switch is unimportant, and I can easily dispense with it. But it seems that using it has unearthed a problem somewhere.
Best regards, The Chief -------- Prof. Abimbola A. Olowofoyeku (The African Chief) web: http://www.bigfoot.com/~african_chief/