This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
fix core dump reading standard input
- To: gcc-patches at gcc dot gnu dot org
- Subject: fix core dump reading standard input
- From: Zack Weinberg <zack at wolery dot cumb dot org>
- Date: Wed, 29 Mar 2000 11:00:58 -0800
- Cc: aj at suse dot de
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);