sjoerd@cwi.nl (Sjoerd Mullender) (02/21/89)
Subject: gcc hangs on certain input files Index: c-parse.y Description: gcc (actually cc1) hangs in an infinte loop when given certain input files. This is true for at least the versions 1.32 and 1.33 of gcc. Since it is in the machine independent part, it happens on all systems (well, at least all unix systems). Repeat-By: Script started on Tue Feb 21 14:49:54 1989 % echo '#pragma' >bug.c % gcc -c -v bug.c gcc version 1.33 /usr/local/lib/gcc-cpp -v -undef -D__GNUC__ -Dmc68000 -Dalliant -Dunix -D__mc68000__ -D__alliant__ -D__unix__ -D__HAVE_68881__ -Dmc68020 bug.c /tmp/cc004390.cpp GNU CPP version 1.33 /usr/local/lib/gcc-cc1 /tmp/cc004390.cpp -quiet -dumpbase bug.c -version -o /tmp/cc004390.s GNU C version 1.33 (Alliant) compiled by GNU C version 1.33. bug.c:1: undefined or invalid # directive ^C% script done on Tue Feb 21 14:50:30 1989 After the error message, the compiler hangs. Type an interrupt (^C in my case) to stop the compiler. Fix: Apply the following diff. This is a context diff against the 1.33 sources. The 1.32 sources have to fixed similarly. You may also want to apply the diff to c-parse.tab.c. The line numbers will vary in that case. Be warned however, I don't know enough about gcc internals to know whether this does any harm. I have no idea why the result of getc was compared to 0 in stead of EOF. It just seemed wrong to me. *** gcc-1.33/c-parse.y- Tue Jan 10 00:43:12 1989 --- gcc-1.33/c-parse.y Tue Feb 21 14:54:07 1989 *************** *** 1732,1738 /* skip the rest of this line. */ skipline: ! while ((c = getc (finput)) && c != '\n'); return c; } --- 1732,1738 ----- /* skip the rest of this line. */ skipline: ! while ((c = getc (finput)) != EOF && c != '\n'); return c; } -- Sjoerd Mullender e-mail: sjoerd@cwi.nl Centre for Mathematics and Computer Science, Amsterdam