From patchwork Fri Mar 1 23:12:10 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Harald Anlauf X-Patchwork-Id: 1050513 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-497259-incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=gmx.de Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b="LRuFY5K0"; 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 44B4vP22mXz9s4Y for ; Sat, 2 Mar 2019 10:12:26 +1100 (AEDT) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender :message-id:date:from:mime-version:to:subject:content-type; q= dns; s=default; b=FYvIVsT2GVrvh6QkCsyHbgJxzM+djM1JJwJrRPigOE43Lj TMHllVsVsvzRjZaxcU3mArm5iIE8tbWU8DnRDBWs/1cJiaaB3oqFVklP6Al/mt2S DoYIk/eb7oL9F/pydToaStiWt2WemeaQPul8FYZZgy07pkB/y4oGNILsovhtE= 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 :message-id:date:from:mime-version:to:subject:content-type; s= default; bh=i8GVUQnkPAYBn6zj8bAQCiRUQwA=; b=LRuFY5K0K+jX58v3SHst kx/zfl/8sfOozbS4uxr3p+G10h9dsrrBmpEfPYCaFSfT9PXfc7/YgRg24I6NZXmM Vt8sUNORc7xivhQ9JjEh5Eph2B8nIjeW4owc/9I63rq/wJSc7mNLoH/u28GNymCU 4EguHPQIVbfDyUPBxkeeEOk= Received: (qmail 117104 invoked by alias); 1 Mar 2019 23:12:18 -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 117077 invoked by uid 89); 1 Mar 2019 23:12:17 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-11.3 required=5.0 tests=BAYES_00, FREEMAIL_FROM, GIT_PATCH_2, GIT_PATCH_3, KAM_ASCII_DIVIDERS, KAM_NUMSUBJECT, RCVD_IN_DNSWL_LOW, SPF_PASS autolearn=ham version=3.3.2 spammy=D*t-online.de, anlauf@gmx.de, U*anlauf, Anlauf X-HELO: mout.gmx.net Received: from mout.gmx.net (HELO mout.gmx.net) (212.227.17.22) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Fri, 01 Mar 2019 23:12:16 +0000 Received: from proton.at.home ([93.207.87.194]) by mail.gmx.com (mrgmx103 [212.227.17.168]) with ESMTPSA (Nemesis) id 0LcBPV-1hQuLp1mOT-00ja4E; Sat, 02 Mar 2019 00:12:12 +0100 Message-ID: <5C79BC4A.2030103@gmx.de> Date: Sat, 02 Mar 2019 00:12:10 +0100 From: Harald Anlauf User-Agent: Mozilla/5.0 (X11; Linux i686; rv:17.0) Gecko/20130329 Thunderbird/17.0.5 MIME-Version: 1.0 To: gfortran , gcc-patches Subject: [PR fortran/77583, patch ]- ICE in pp_quoted_string, at pretty-print.c:966 The attached patch (originally by Steve Kargl) fixes a NULL pointer dereference that may occur when checking for a conflict. Regtested successfully. OK for trunk? Backport to active branches? Thanks, Harald 2019-03-02 Harald Anlauf Steve Kargl PR fortran/77583 * symbol.c (check_conflict): Check for valid procedure name passed to error reporting routine. 2019-03-02 Harald Anlauf PR fortran/77583 * gfortran.dg/pr77583.f90: New test. Index: gcc/testsuite/gfortran.dg/pr77583.f90 =================================================================== --- gcc/testsuite/gfortran.dg/pr77583.f90 (nonexistent) +++ gcc/testsuite/gfortran.dg/pr77583.f90 (working copy) @@ -0,0 +1,10 @@ +! { dg-do compile } +! +! PR fortran/77583 - ICE in pp_quoted_string, at pretty-print.c:966 +! Contributed by Gerhard Steinmetz + +pure subroutine sub(s) +contains + pure subroutine s ! { dg-error "conflicts with DUMMY argument" } + end +end Index: gcc/fortran/symbol.c =================================================================== --- gcc/fortran/symbol.c (revision 269332) +++ gcc/fortran/symbol.c (working copy) @@ -525,7 +525,7 @@ /* The copying of procedure dummy arguments for module procedures in a submodule occur whilst the current state is COMP_CONTAINS. It is necessary, therefore, to let this through. */ - if (attr->dummy + if (name && attr->dummy && (attr->function || attr->subroutine) && gfc_current_state () == COMP_CONTAINS && !(gfc_new_block && gfc_new_block->abr_modproc_decl))