This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

fix core dump reading standard input


cpp currently core dumps if asked to read standard input.  This fixes
that.

zw

	* cppfiles.c (cpp_read_file): Don't pass zero-length string to
	_cpp_calc_hash.

===================================================================
Index: cppfiles.c
--- cppfiles.c	2000/03/28 21:45:02	1.50
+++ cppfiles.c	2000/03/29 19:00:17
@@ -623,7 +623,11 @@ cpp_read_file (pfile, fname)
     fname = "";
 
   dummy.nshort = fname;
-  dummy.hash = _cpp_calc_hash (fname, strlen (fname));
+  /* _cpp_calc_hash doesn't like zero-length strings.  */
+  if (*fname == 0)
+    dummy.hash = 0;
+  else
+    dummy.hash = _cpp_calc_hash (fname, strlen (fname));
   slot = (IHASH **) htab_find_slot_with_hash (pfile->all_include_files,
 					      (const void *) &dummy,
 					      dummy.hash, 1);

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]