cpp crash with gcc-2.95.2 and cpplib

Niels M=f6ller nisse@ehand.com
Tue Dec 12 04:42:00 GMT 2000

Neil Booth <neil@daikokuya.demon.co.uk> writes:

> Niels M=f6ller wrote:-
> > I originally encountered this bug with John's patched gcc
> > (prc-tools-2.0), however, the bug is present also in the plain
> > gcc-2.95.2, when compiled with --enable-cpplib.
> Hmmm.  Either don't --enable-cpplib, or try CVS GCC or a recent
> snapshot.  I'd be interested if the problem still exists.

I've checked out and compiled the latest gcc from cvs (using
./configure && make bootstrap, with no --enable-cpplib this time). I'm
not sure exactly what you want me to do with it (i.e. what is the best
way to run only the preprocessor, if it is now merged with the main
compilers), but I tried running the built cpp0 program, and it still
crashes, in a different way:

  jekyll:~/build/prc-tools-2.0$ ~/hack/gcc/gcc/cpp0  -lang-c -I/usr/local/src/prc-tools-2.0/libc/include -I/usr/local/src/prc-tools-2.0/libc/../crt -D__GNUC__=3d2 -D__GNUC_MINOR__=3d95 -Dm68000 -Dmc68000 -Dm68k -D__palmos__ -D__m68000__ -D__mc68000__ -D__m68k__ -D__palmos__ -D__m68000 -D__mc68000 -D__m68k '-Asystem(palmos)' '-Acpu(m68k)' '-Amachine(pilot)' -D__OPTIMIZE__ -Wall -Dmc68000 -D__mc68000 -D__mc68000__ -isystem /usr/local/palmdev/include -isystem /usr/local/palmdev/sdk-3.5/include/Core/System -isystem /usr/local/palmdev/sdk-3.5/include/Core/UI -isystem /usr/local/palmdev/sdk-3.5/include -isystem /usr/local/palmdev/sdk-3.5/include/Core -isystem /usr/local/palmdev/sdk-3.5/include/Core/Hardware -isystem /usr/local/palmdev/sdk-3.5/include/Core/System/Unix -remap -DPRINT_FLOATS -DSDK_VERSION=3d35 -DLmalloc /usr/local/src/prc-tools-2.0/libc/malloc.c /tmp/cc6cix17.i
  In file included from /usr/local/src/prc-tools-2.0/libc/malloc.c:7:
  /usr/local/src/prc-tools-2.0/libc/include/stdlib.h:10:20: stddef.h: No such file or directory
  Segmentation fault

Backtrace from gdb:

#0  0x8052029 in _cpp_parse_expr (pfile=3d0x805b5a0) at cppexp.c:843
#1  0x8051ac5 in _cpp_parse_expr (pfile=3d0x805b5a0) at cppexp.c:901
#2  0x804a476 in glue_header_name (pfile=3d0x805b5a0, header=3d0x805ac5c)
    at cpplib.c:512
#3  0x8049a48 in print_line (special_flags=3d0x805b5a0 "") at cppmain.c:291
#4  0x804ba6c in _cpp_define_builtin (pfile=3d0x805b5a0, 
    str=3d0x8055b04 "=b6\006\203=e8-u\203\017=b6F\001=e9z=ff=ff=ff\213E\b=c6\200q\001")
    at cpplib.c:1633
#5  0x8048fdd in strcmp ()
#6  0x4002ea52 in ?? ()

The location of the crach seems to be

	    case CPP_MULT:
	      top->unsignedp =3d unsigned1 | unsigned2;
	      if (top->unsignedp)
		top->value =3d (unsigned HOST_WIDEST_INT) v1 * v2;
	      else if (!skip_evaluation)
		  top->value =3d v1 * v2;
		  if (v1 && (top->value / v1 !=3d v2
=3d=3d>		             || (top->value & v1 & v2) < 0))
		    integer_overflow (pfile);

I don't see anything that's obviously wrong, though,

(gdb) p/x v1
$4 =3d 0x400ec860000000c0
(gdb) p/x v2
$5 =3d 0x806068bbffff634
(gdb) p/x *top
$6 =3d {op =3d 0x400ec920, prio =3d 0x20, flags =3d 0xc9, unsignedp =3d 0xe, value =3d 0x0}

(Running the programs cpp or xgcc -E didn't work, they just complain
that they don't recognize the -remap option).


More information about the Gcc-bugs mailing list