From patchwork Thu Jan 5 09:00:33 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?Martin_Li=C5=A1ka?= X-Patchwork-Id: 89961 Delivered-To: patch@linaro.org Received: by 10.140.20.101 with SMTP id 92csp8870992qgi; Thu, 5 Jan 2017 01:01:08 -0800 (PST) X-Received: by 10.98.101.71 with SMTP id z68mr60059206pfb.165.1483606868211; Thu, 05 Jan 2017 01:01:08 -0800 (PST) Return-Path: Received: from sourceware.org (server1.sourceware.org. [209.132.180.131]) by mx.google.com with ESMTPS id 71si75387581pfj.64.2017.01.05.01.01.07 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 05 Jan 2017 01:01:08 -0800 (PST) Received-SPF: pass (google.com: domain of gcc-patches-return-445429-patch=linaro.org@gcc.gnu.org designates 209.132.180.131 as permitted sender) client-ip=209.132.180.131; Authentication-Results: mx.google.com; dkim=pass header.i=@gcc.gnu.org; spf=pass (google.com: domain of gcc-patches-return-445429-patch=linaro.org@gcc.gnu.org designates 209.132.180.131 as permitted sender) smtp.mailfrom=gcc-patches-return-445429-patch=linaro.org@gcc.gnu.org DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:to :from:subject:message-id:date:mime-version:content-type; q=dns; s=default; b=T9wgE7dcnVJOtT+RaYdykeaoc9fv8/SeAEE0CLpnzXu4Q8zEqJ JkLYRdunXMft8kPT2ity8QNEdPtGe2c1UH1kzEyLPoUWMIvG6THcbkh+oIWFl0Eu wh2bfmCmAoMYNUwI4vWEfmEiAE3tPQHET+p5yBY3ddWtr7EdUaqgjoG04= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:to :from:subject:message-id:date:mime-version:content-type; s= default; bh=VSIIsS7Cve04M0w0M+zrrosEHqc=; b=dcY2whvxvGf42fZKvuYo rqvaMc2YA9rNUb8FsS3LEGaFNciaYngxEA5NCFufJogaJP3oc0Dhib2mIBYwZjyK w+XfSaCF098nZhXwBb3j/Ed/3AHvyEckp+3p5U35Zxlwa5GY1r+KI5g0WjNTaNMc 4vwz5GFFGlb/pQ3NugeZAqw= Received: (qmail 94883 invoked by alias); 5 Jan 2017 09:00:47 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org Received: (qmail 94869 invoked by uid 89); 5 Jan 2017 09:00:46 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.9 required=5.0 tests=BAYES_00, SPF_PASS autolearn=ham version=3.3.2 spammy=Hx-languages-length:1520, sum X-HELO: mx2.suse.de Received: from mx2.suse.de (HELO mx2.suse.de) (195.135.220.15) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 05 Jan 2017 09:00:36 +0000 Received: from relay1.suse.de (charybdis-ext.suse.de [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id A01B2AB1D for ; Thu, 5 Jan 2017 09:00:34 +0000 (UTC) To: GCC Patches From: =?UTF-8?Q?Martin_Li=c5=a1ka?= Subject: [PATCH] Fix precompiled header for '-' being input file (PR, pch/78970) Message-ID: <2577a04a-611e-ab46-b2c5-f39c71f02cca@suse.cz> Date: Thu, 5 Jan 2017 10:00:33 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.5.1 MIME-Version: 1.0 X-IsSubscribed: yes 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 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 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