cpp crash with gcc-2.95.2 and cpplib

Niels M=f6ller nisse@ehand.com
Wed Dec 13 01:39:00 GMT 2000


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

> Niels M=f6ller wrote:-
> 
> > should help. But perhaps it's better to change read_name_map to return
> > NULL on error?
> 
> Yes, that looks like it.  Could you try this patch?  If it works for
> you, I'll commit it.

It doesn't quite work. But if I add some more initialization,

--- /usr/local/src/prc-tools-2.0/gcc/gcc/cppfiles.c~	Fri Dec  8 15:21:39 2000
+++ /usr/local/src/prc-tools-2.0/gcc/gcc/cppfiles.c	Wed Dec 13 10:27:46 2000
@@ -481,16 +481,17 @@
   map_list_ptr =3d ((struct file_name_map_list *)
 		  xmalloc (sizeof (struct file_name_map_list)));
   map_list_ptr->map_list_name =3d xstrdup (dirname);
+  map_list_ptr->map_list_map =3d NULL;

   name =3d (char *) alloca (strlen (dirname) + strlen (FILE_NAME_MAP_FILE) + 2);
   strcpy (name, dirname);
   if (*dirname)
     strcat (name, "/");

it seems to work.

But I'm wondering why -1 was used in the first place. Perhaps storing
-1 in loc->name_map is a way to cache negative results, "I already
looked for header.gcc here, and there's no point trying again"? If
so, the change will cause a lot of unnesseccary syscalls.

/Niels


More information about the Gcc-bugs mailing list