G++ first reports an internal compiler error and segfault and then appears to go into an infinite loop when I try to compile the enclosed under Cygwin
Created attachment 5083 [details] test case
I cannot reproduce this problem on i686-pc-linux-gnu with 3.4 (20031107), 3.2.3, or 3.3.1 (20030707), 3.3.3 (20031105), or 3.3 (20021216). Can you provide the exact comand you invoke to get the seg fault? Also provide the exact version of gcc, by giving the output of gcc -v?
Subject: Re: segmentation fault "pinskia at gcc dot gnu dot org" <gcc-bugzilla@gcc.gnu.org> writes: g++ -c -Wall -ftemplate-depth-100 -g -O0 -fno-inline -v -I "c:\boost" -o "bix.test\gcc\debug\bix.obj" "bix.cpp" Reading specs from /usr/lib/gcc-lib/i686-pc-cygwin/3.3.1/specs Configured with: /netrel/src/gcc-3.3.1-2/configure --enable-languages=c,c++,f77,java --enable-libgcj --enable-threads=posix --with-system-zlib --enable-nls --without-included-gettext --enable-interpreter --enable-sjlj-exceptions --disable-version-specific-runtime-libs --enable-shared --build=i686-pc-linux --host=i686-pc-cygwin --target=i686-pc-cygwin --prefix=/usr --exec-prefix=/usr --sysconfdir=/etc --libdir=/usr/lib --includedir=/nonexistent/include --libexecdir=/usr/sbin Thread model: posix gcc version 3.3.1 (cygming special) /usr/lib/gcc-lib/i686-pc-cygwin/3.3.1/cc1plus.exe -quiet -v -I c:\boost -D__GNUC__=3 -D__GNUC_MINOR__=3 -D__GNUC_PATCHLEVEL__=1 -D__CYGWIN32__ -D__CYGWIN__ -Dunix -D__unix__ -D__unix -idirafter /usr/lib/gcc-lib/i686-pc-cygwin/3.3.1/../../../../include/w32api -idirafter /usr/lib/gcc-lib/i686-pc-cygwin/3.3.1/../../../../i686-pc-cygwin/lib/../../include/w32api bix.cpp -D__GNUG__=3 -quiet -dumpbase bix.cpp -auxbase-strip bix.test\gcc\debug\bix.obj -g -O0 -Wall -version -ftemplate-depth-100 -fno-inline -o /cygdrive/c/DOCUME~1/dave/LOCALS~1/Temp/ccl4SuA3.s GNU C++ version 3.3.1 (cygming special) (i686-pc-cygwin) compiled by GNU C version 3.3.1 (cygming special). GGC heuristics: --param ggc-min-expand=64 --param ggc-min-heapsize=65467 ignoring nonexistent directory "/usr/i686-pc-cygwin/include" ignoring duplicate directory "/usr/i686-pc-cygwin/lib/../../include/w32api" #include "..." search starts here: #include <...> search starts here: c:/boost /usr/include/c++/3.3.1 /usr/include/c++/3.3.1/i686-pc-cygwin /usr/include/c++/3.3.1/backward /usr/local/include /usr/lib/gcc-lib/i686-pc-cygwin/3.3.1/include /usr/include /usr/include/w32api End of search list. bix.cpp: In function `int main()': bix.cpp:14: internal compiler error: Segmentation fault
What happens if you remove the "-g" from the command line?
Subject: Re: segmentation fault g++ -c -Wall -ftemplate-depth-100 -O0 -fno-inline -v -I "c:\boost" -o "bix.test\gcc\debug\bix.obj" "her.cpp" Reading specs from /usr/lib/gcc-lib/i686-pc-cygwin/3.3.1/specs Configured with: /netrel/src/gcc-3.3.1-2/configure --enable-languages=c,c++,f77,java --enable-libgcj --enable-threads=posix --with-system-zlib --enable-nls --without-included-gettext --enable-interpreter --enable-sjlj-exceptions --disable-version-specific-runtime-libs --enable-shared --build=i686-pc-linux --host=i686-pc-cygwin --target=i686-pc-cygwin --prefix=/usr --exec-prefix=/usr --sysconfdir=/etc --libdir=/usr/lib --includedir=/nonexistent/include --libexecdir=/usr/sbin Thread model: posix gcc version 3.3.1 (cygming special) /usr/lib/gcc-lib/i686-pc-cygwin/3.3.1/cc1plus.exe -quiet -v -I c:\boost -D__GNUC__=3 -D__GNUC_MINOR__=3 -D__GNUC_PATCHLEVEL__=1 -D__CYGWIN32__ -D__CYGWIN__ -Dunix -D__unix__ -D__unix -idirafter /usr/lib/gcc-lib/i686-pc-cygwin/3.3.1/../../../../include/w32api -idirafter /usr/lib/gcc-lib/i686-pc-cygwin/3.3.1/../../../../i686-pc-cygwin/lib/../../include/w32api her.cpp -D__GNUG__=3 -quiet -dumpbase her.cpp -auxbase-strip bix.test\gcc\debug\bix.obj -O0 -Wall -version -ftemplate-depth-100 -fno-inline -o /cygdrive/c/DOCUME~1/dave/LOCALS~1/Temp/ccFXHAz8.s GNU C++ version 3.3.1 (cygming special) (i686-pc-cygwin) compiled by GNU C version 3.3.1 (cygming special). GGC heuristics: --param ggc-min-expand=64 --param ggc-min-heapsize=65467 ignoring nonexistent directory "/usr/i686-pc-cygwin/include" ignoring duplicate directory "/usr/i686-pc-cygwin/lib/../../include/w32api" #include "..." search starts here: #include <...> search starts here: c:/boost /usr/include/c++/3.3.1 /usr/include/c++/3.3.1/i686-pc-cygwin /usr/include/c++/3.3.1/backward /usr/local/include /usr/lib/gcc-lib/i686-pc-cygwin/3.3.1/include /usr/include /usr/include/w32api End of search list. her.cpp: In function `int main()': her.cpp:14: internal compiler error: Segmentation fault
Changing this to invalid to ...
change to unconfirmed.
3.3.1 is getting old at this point and your compiler is not a FSF compiler, can you test 3.3.2 and maybe also report this to cygwin?
I can't reproduce this with either 3.3.1 or 3.3 branch (20031122) cross-compilers to i686-pc- cygwin.
The stack size on cygwin is too low, you have to compile GCC with a raised stack size (look at man ld or info ld for the option to pass to gcc to recompile gcc).
Is it not possible to print a better error message than 'segmentation error' in this case? For example, on Darwin GCC prints: Out of stack space. Try running `ulimit -S -s unlimited' in the shell to raise its limit. (See config/rs6000/host-darwin.c.)
Yes it is but this is a known issue with cygwin and that you cannot change the stack size by using limit/ulimit on cygwin at all so you have to recompile GCC anyway.