Having '-' used as indication that input should be taken from standard input is unfriendly to pch which calculates md5sum of all input file descriptors. With that fdopen fails for STDIN_FILENO. To be honest my patch is just a workaround for the ICE. Is there a better solution for that?
Patch can bootstrap on ppc64le-redhat-linux and survives regression tests. Ready to be installed? Martin
>From ad7f98ed0412e5213f5be9894bcf021b6bf93450 Mon Sep 17 00:00:00 2001 From: marxin <mli...@suse.cz> Date: Wed, 4 Jan 2017 16:04:44 +0100 Subject: [PATCH] Fix precompiled header for '-' being input file (PR pch/78970) libcpp/ChangeLog: 2017-01-04 Martin Liska <mli...@suse.cz> PR pch/78970 * files.c (_cpp_save_file_entries): Do not calculate md5sum when input file is STDIN. --- libcpp/files.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/libcpp/files.c b/libcpp/files.c index 969a531033f..cc597d4f22a 100644 --- a/libcpp/files.c +++ b/libcpp/files.c @@ -1885,9 +1885,13 @@ _cpp_save_file_entries (cpp_reader *pfile, FILE *fp) free (result); return false; } - ff = fdopen (f->fd, "rb"); - md5_stream (ff, result->entries[count].sum); - fclose (ff); + /* Skip STDIN as fdopen would fail for the file descriptor. */ + if (f->fd != STDIN_FILENO) + { + ff = fdopen (f->fd, "rb"); + md5_stream (ff, result->entries[count].sum); + fclose (ff); + } f->fd = oldfd; } result->entries[count].size = f->st.st_size; -- 2.11.0