From patchwork Thu May 10 18:17:15 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marek Polacek X-Patchwork-Id: 911500 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=gcc.gnu.org (client-ip=209.132.180.131; helo=sourceware.org; envelope-from=gcc-patches-return-477527-incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b="eKClf6zQ"; dkim-atps=neutral Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 40hhK94XGzz9s19 for ; Fri, 11 May 2018 04:17:31 +1000 (AEST) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:date :from:to:subject:message-id:mime-version:content-type; q=dns; s= default; b=ZkOUi6yBuCdNScVCSxc8EvQ/KhREU5swPYTZxWIlnVphuC9Y02CER +SmqAoaUvfZMJ/w1c5v1Mvj4oNdDato50qnuvDT6KhbsyK/eT83fbhUv3KrIVK3p TxVWqLP/1vw10eCkU0pHlkgPn2ZvpoKcaCPf4+8zsRL0RU9V0wHi9c= 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:date :from:to:subject:message-id:mime-version:content-type; s= default; bh=Q0RaqbHhnm20j3U10ioXqoUcRlI=; b=eKClf6zQj26l7Fi3IW11 bNmIUCvg1vHaIY14QrrwxDVnKAP+rQ3O+PSUWCR7R0MGfu/pIqBIBz4YpFSzAoSR D0RsclXM5iFxj8pLTxAyntCOoOuiLdDgyM8bjIqPmKSs6XoURK/hDTNoGVl5tNlE 7nfh4BOG147TwyotObSvU/c= Received: (qmail 92844 invoked by alias); 10 May 2018 18:17:20 -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 92812 invoked by uid 89); 10 May 2018 18:17:19 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-25.6 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, SPF_HELO_PASS autolearn=ham version=3.3.2 spammy=our X-Spam-User: qpsmtpd, 2 recipients X-HELO: mx1.redhat.com Received: from mx3-rdu2.redhat.com (HELO mx1.redhat.com) (66.187.233.73) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 10 May 2018 18:17:18 +0000 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 08BEE8185346; Thu, 10 May 2018 18:17:17 +0000 (UTC) Received: from redhat.com (ovpn-123-94.rdu2.redhat.com [10.10.123.94]) by smtp.corp.redhat.com (Postfix) with ESMTPS id D66BE2166BAD; Thu, 10 May 2018 18:17:16 +0000 (UTC) Date: Thu, 10 May 2018 14:17:15 -0400 From: Marek Polacek To: GCC Patches , Fortran Subject: PATCH for fortran/85735, f951 crash on empty input Message-ID: <20180510181715.GL12969@redhat.com> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.9.3 (2018-01-21) Running ./f951 -quiet ^D crashes in gfc_create_decls: /* Build our translation-unit decl. */ current_translation_unit = build_translation_unit_decl (get_identifier (main_input_filename)); because main_input_filename is null in this case. We can fix it like below, where main_input_filename will be set to "". Bootstrapped/regtested on x86_64-linux, ok for trunk? 2018-05-10 Marek Polacek PR fortran/85735 * options.c (gfc_post_options): Set main_input_filename. Marek diff --git gcc/fortran/options.c gcc/fortran/options.c index 1405f1cf008..3c17a583f62 100644 --- gcc/fortran/options.c +++ gcc/fortran/options.c @@ -313,6 +313,7 @@ gfc_post_options (const char **pfilename) if (gfc_current_form == FORM_UNKNOWN) { gfc_current_form = FORM_FREE; + main_input_filename = filename; gfc_warning_now (0, "Reading file %qs as free form", (filename[0] == '\0') ? "" : filename); }