From patchwork Sun Jun 14 15:40:42 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Koenig X-Patchwork-Id: 1308972 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=2620:52:3:1:0:246e:9693:128c; helo=sourceware.org; envelope-from=gcc-patches-bounces@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=gcc.gnu.org Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.a=rsa-sha256 header.s=default header.b=R0xGH8my; dkim-atps=neutral Received: from sourceware.org (server2.sourceware.org [IPv6:2620:52:3:1:0:246e:9693:128c]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 49lJZt2PmNz9sQx for ; Mon, 15 Jun 2020 01:40:53 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id ACB87395B0A6; Sun, 14 Jun 2020 15:40:48 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org ACB87395B0A6 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1592149248; bh=uIYvTa+0yM2euI4HMgNkDPx1fXY0C/GQ48VI5yWXuwE=; h=To:Subject:Date:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:From; b=R0xGH8my3s9m7y/mUi45ygxT6+sV3ufu1Z9HDcUqWUWAvDIZTD31aVtLuulDmmeTN GsB9uKyWi2SDSQRhcXZmBT3dBrF82yhzjJ58uMsoLBvodH9bsTC6YnHIk677T8YXUo yKSiNTvw5HBIJTZFkCrlf+jBNhLp0pRRuiNlAPKk= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from cc-smtpout3.netcologne.de (cc-smtpout3.netcologne.de [IPv6:2001:4dd0:100:1062:25:2:0:3]) by sourceware.org (Postfix) with ESMTPS id 83E133887005; Sun, 14 Jun 2020 15:40:45 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 83E133887005 Received: from cc-smtpin3.netcologne.de (cc-smtpin3.netcologne.de [89.1.8.203]) by cc-smtpout3.netcologne.de (Postfix) with ESMTP id E0D7112901; Sun, 14 Jun 2020 17:40:43 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by cc-smtpin3.netcologne.de (Postfix) with ESMTP id DC30511EF7; Sun, 14 Jun 2020 17:40:43 +0200 (CEST) Received: from [2001:4dd6:36e3:0:5b1c:29fc:15e7:fe34] (helo=cc-smtpin3.netcologne.de) by localhost with ESMTP (eXpurgate 4.11.6) (envelope-from ) id 5ee644fb-7104-7f0000012729-7f0000019d7e-1 for ; Sun, 14 Jun 2020 17:40:43 +0200 Received: from linux-p51k.fritz.box (2001-4dd6-36e3-0-5b1c-29fc-15e7-fe34.ipv6dyn.netcologne.de [IPv6:2001:4dd6:36e3:0:5b1c:29fc:15e7:fe34]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by cc-smtpin3.netcologne.de (Postfix) with ESMTPSA; Sun, 14 Jun 2020 17:40:42 +0200 (CEST) To: "fortran@gcc.gnu.org" , gcc-patches Subject: [patch, Fortran, committed] Fix a crash with a developer's option Message-ID: <53cafe9a-ad5c-7c92-4307-c7b1e6fb5cb3@netcologne.de> Date: Sun, 14 Jun 2020 17:40:42 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.9.0 MIME-Version: 1.0 Content-Language: de-DE X-Spam-Status: No, score=-10.1 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_LOW, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Thomas Koenig via Gcc-patches From: Thomas Koenig Reply-To: Thomas Koenig Errors-To: gcc-patches-bounces@gcc.gnu.org Sender: "Gcc-patches" Committed as obvious, simple and risk-free after checking that it still compiles. It does not fix the PR in question, it it just something that was noted in one of the comments. Regards Thomas Avoid crash when global symbol table is empty with -fdump-fortran-global. This just avoids a crash with -fdump-fortran-global when the global symbol table is empty. This is strictly a developer's option, no user impact. gcc/fortran/ChangeLog: 2020-06-14 Thomas Koenig PR fortran/42122 * dump-parse-tree.c (gfc_dump_global_symbols): If the symroot is empty, just output "empty". diff --git a/gcc/fortran/dump-parse-tree.c b/gcc/fortran/dump-parse-tree.c index f32330685e7..f44648879f5 100644 --- a/gcc/fortran/dump-parse-tree.c +++ b/gcc/fortran/dump-parse-tree.c @@ -3595,5 +3595,8 @@ show_global_symbol (gfc_gsymbol *gsym, void *f_data) void gfc_dump_global_symbols (FILE *f) { - gfc_traverse_gsymbol (gfc_gsym_root, show_global_symbol, (void *) f); + if (gfc_gsym_root == NULL) + fprintf (f, "empty\n"); + else + gfc_traverse_gsymbol (gfc_gsym_root, show_global_symbol, (void *) f); }