This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
Re: cpp segfault in dbz testsuite
On Tue, Mar 14, 2000 at 06:04:30PM +0100, Andreas Jaeger wrote:
> >>>>> Franz Sirl writes:
>
> > Hi,
> > since yesterday (it was OK on Saturday morning) I see this segfault in the
> > dbz testsuite on powerpc-linux-gnu (glibc-2.1.3):
>
> > /home/fsirl/obj/gccm/gcc/xgcc -B/home/fsirl/obj/gccm/gcc/
> > -B/home/fsirl/gnubin/ppc-redhat-linux/bin/ rdbzmain.o rdbz.o
> > case.o ../libio.a ../../libi
> > berty/libiberty.a -o rdbz
> > /home/fsirl/obj/gccm/gcc/xgcc -B/home/fsirl/obj/gccm/gcc/
> > -B/home/fsirl/gnubin/ppc-redhat-linux/bin/ -g -O2
> > -I../../../../../cvsx/gccm/libio/dbz -I..
> > -I../../../../../cvsx/gccm/libio/dbz/.. -DDBZ_FINISH='_IO_flush_all()' -c
> > ../../../../../cvsx/gccm/libio/dbz/fake.c
> > xgcc: Internal compiler error: program cpp got fatal signal 11
> > make[3]: *** [fake.o] Error 1
>
> > If it isn't reproducible on another platform, I'll try to find time to
> > debug it before my snowboarding vacation.
>
> I've got the same problem on i686 (see my emails from yesterday to
> gcc-bugs for details) - but unfortunatly Zack can't reproduce it and I
> wasn't successful in debugging either. :-(
I suspect it's the same bug as the one Ulrich told me about when
compiling libc. If it is, then this patch should fix it.
zw
* cppfiles.c (find_include_file): Don't assume nshort is a
substring of name.
===================================================================
Index: cppfiles.c
--- cppfiles.c 2000/03/14 06:34:11 1.47
+++ cppfiles.c 2000/03/14 17:09:44
@@ -257,13 +257,20 @@ find_include_file (pfile, fname, search_
if (f == -1)
return -1;
- ih = (IHASH *) xmalloc (sizeof (IHASH) + strlen (name));
- strcpy ((char *)ih->name, name);
- ih->foundhere = path;
if (path == ABSOLUTE_PATH)
- ih->nshort = ih->name;
+ {
+ ih = (IHASH *) xmalloc (sizeof (IHASH) + strlen (name));
+ ih->nshort = ih->name;
+ }
else
- ih->nshort = strstr (ih->name, fname);
+ {
+ ih = (IHASH *) xmalloc (sizeof (IHASH) + strlen (name)
+ + strlen (fname) + 1);
+ ih->nshort = ih->name + strlen (fname) + 1;
+ strcpy ((char *)ih->nshort, fname);
+ }
+ strcpy ((char *)ih->name, name);
+ ih->foundhere = path;
ih->control_macro = NULL;
ih->hash = dummy.hash;