Segmentation fault w/ g++ for 2.95.2 19991024 on i686-pc-linux-gnu

Bill Priest bpriest@comspacecorp.com
Mon Nov 15 05:40:00 GMT 1999


All,
	The appears to be some kind of command line parsing bug; although
it happens on linux but not on solaris.

touch any_non_existent_file.c
g++ -Wshadow -Wcast-align -Wmissing-prototypes -Wno-long-long -I. -lm -c any_non_existent_file.c

Segmentation fault (core dumped)

If you add -v it doesn't core dump.
If you add --save-temps it doesn't core dump.
Replacing g++ w/ gcc and it doesn't happen.
I duplicated this on a Pentium-100 as well as Pentium-500 so I don't think it
is a machine specific hardware problem.

I built gcc in a separate "obj" directory w/ "./configure --prefix=/usr/local"
followed by "make bootstrap" followed by "make check".  I still have the
build directories and such.

Getting in gdb and doing a bt

GNU gdb 4.18
Copyright 1998 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 "i386-redhat-linux"...
Core was generated by `g++ -Wshadow -Wcast-align -Wmissing-prototypes -Wno-long-long -I. -lm -c any_no'.
Program terminated with signal 11, Segmentation fault.
Reading symbols from /lib/libc.so.6...done.
Reading symbols from /lib/ld-linux.so.2...done.
#0  0x40070e79 in chunk_free (ar_ptr=0x40105040, p=0x5f75) at malloc.c:3030
3030	malloc.c: No such file or directory.
(gdb) bt
#0  0x40070e79 in chunk_free (ar_ptr=0x40105040, p=0x5f75) at malloc.c:3030
#1  0x40070bfd in chunk_alloc (ar_ptr=0x40105040, nb=16) at malloc.c:2541
#2  0x4007040a in __libc_malloc (bytes=10) at malloc.c:2643
#3  0x8051eb2 in concat (first=0x8058654 "@") at ../../gcc/prefix.c:152
#4  0x805213d in update_path (path=0x8056c87 "/usr/local/lib/gcc-lib/", key=0x8057e9a "BINUTILS") at ../../gcc/prefix.c:298
#5  0x804ab8b in add_prefix (pprefix=0x805a3e4, prefix=0x8056c87 "/usr/local/lib/gcc-lib/", component=0x8057e9a "BINUTILS", first=0, require_machine_suffix=2, warn=0x0) at ../../gcc/gcc.c:2146
#6  0x804c5f2 in process_command (argc=11, argv=0x805e568) at ../../gcc/gcc.c:3060
#7  0x804fba5 in main (argc=9, argv=0xbffff904) at ../../gcc/gcc.c:4740

Some of the line number info makes no sense (malloc.c has only 552 lines).

Went up 7 times.
Verified that the parameters coming in from the shell matched above.

Noticed strangeness from gdb 4.18 (indicates 3 breakpoints when just
doing gdb ./g++ in gcc-2.95.2/objdir/gcc)???

I guess I'll have to download gdb 4.17 and get it installed; the above
makes me think I might be wasting my time debugging.

If you need any further information; feel free to email me directly
or just send to the list.

Regards,

Bill


More information about the Gcc-bugs mailing list