From patchwork Wed Feb 15 21:50:05 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Harald Anlauf X-Patchwork-Id: 57743 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp436059wrn; Wed, 15 Feb 2023 13:51:09 -0800 (PST) X-Google-Smtp-Source: AK7set9BGvkpemU4WyNV6gElEup+T1Pc5a3UVfljF/QtuBoXHKoPQ/YZuDS68cRLwkwW3s0/xDEf X-Received: by 2002:a17:906:a38e:b0:887:ebaa:7adb with SMTP id k14-20020a170906a38e00b00887ebaa7adbmr4214390ejz.12.1676497869513; Wed, 15 Feb 2023 13:51:09 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1676497869; cv=none; d=google.com; s=arc-20160816; b=vnDPnZ/ay87zGngu37Pp/IwOZAvod2aw479MIeeS6MsHvnF46nJZnZ6KkSmQ1HxuLK cHe48p4Ir9Vb46JxE5d1VvOvfItW1l7apk3wgrabolRoW6zANlM7s8Hy5UKx4s50ElQb eMFyBNNYCCPm8bqDUGnJKgEc3NodXscPCawwunPMHDSBIQcRDvIf+5FxglvUmCh31+T1 I7UWdHdcvhPEPDfqyS9PvJF9AgegGhaw8JKpca6eIs/M7azswLBvFA9UsdkPRlgMzPGR Xh7mRkQAdkkkx95wTS+6o68P4+54AkFDDIifZZznkDu6oTkZN1/ZmpR+tGZ0ro0lDWU6 xInQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:reply-to:from:list-subscribe:list-help:list-post :list-archive:list-unsubscribe:list-id:precedence:ui-outboundreport :sensitivity:importance:date:subject:to:message-id:mime-version :dmarc-filter:delivered-to:dkim-signature:dkim-filter; bh=aXKKX7nqZOAA9dzmLC3zv4Od0qg5QLoeLQb1zj8zdsc=; b=U0bP6UdK9o79LeiSQVFcL4E7kYmUrMCuqKe5jA7bjZcE8/5IfozkL9bm7LW6dzvIqk KgnHKIkJ7W7Oeopkn103R7UN6h0vGtN8sdEyTSri0QSSpTw6AH3HeFrxf2BO2mh/MV49 yk6JOj3mQ5VvGTu9vC8sD7Lm3lUvGhyoMfrh+6kfUjBMXcjH60RdBU0VC4thf39DwYUT 1QJ0DA22GnN5ANLBWAPKze09yArTe2CLZFzJijMFO4M3iipqw7CjUmx0WJQNQm/17AeR XFv6UrmKrwHrjBvtJG+DBooX9YrIL9jDWMG8pt8Vye0fs4YP3Scpaka8QGF1pHW/deYR ZTIA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=rvE7F8a2; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gnu.org Received: from sourceware.org (server2.sourceware.org. [8.43.85.97]) by mx.google.com with ESMTPS id f30-20020a170906739e00b008b13a1b0dc8si4452434ejl.1009.2023.02.15.13.51.09 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 15 Feb 2023 13:51:09 -0800 (PST) Received-SPF: pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) client-ip=8.43.85.97; Authentication-Results: mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=rvE7F8a2; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gnu.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 4AACD385B507 for ; Wed, 15 Feb 2023 21:51:03 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 4AACD385B507 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1676497863; bh=aXKKX7nqZOAA9dzmLC3zv4Od0qg5QLoeLQb1zj8zdsc=; h=To:Subject:Date:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:From; b=rvE7F8a22p/7otayTzRXR6yXrvPyurgYtNYLfojQk/BkVDRBbXuMcCqZs2qc7eH5+ zEx6c2QmO8uzx/fn2Wz2mQGbS735L5PAhctX7ayupuCMmQ/3LTqdxc1k03kaLnc7S2 ManuHMxaqa/1vIPRBo3Uh6hv50vKwPi5Nb0kdXH4= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mout.gmx.net (mout.gmx.net [212.227.15.19]) by sourceware.org (Postfix) with ESMTPS id 532A93858D28; Wed, 15 Feb 2023 21:50:07 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 532A93858D28 X-UI-Sender-Class: 724b4f7f-cbec-4199-ad4e-598c01a50d3a Received: from [79.251.15.143] ([79.251.15.143]) by web-mail.gmx.net (3c-app-gmx-bs56.server.lan [172.19.170.140]) (via HTTP); Wed, 15 Feb 2023 22:50:05 +0100 MIME-Version: 1.0 Message-ID: To: fortran , gcc-patches Subject: [PATCH, committed] Fortran: error recovery on checking procedure argument intent [PR103608] Date: Wed, 15 Feb 2023 22:50:05 +0100 Importance: normal Sensitivity: Normal X-Priority: 3 X-Provags-ID: V03:K1:zcaRwsba5Cfa1QPVyq64KfepG2mFrdOzOeCq0Z2UMUzgdcBo/vUOK+XzzLfod2sAqJ8Uv D345jV2jo+xzJVpn0yIBcme8sCcEkfHG3mgLYb8oG00PU6+ACkBoI6M2DL3qP0Xn7AYpve8F80RD RNsw4sYIKRmOoZWXLMelfvQENqZsoUeUgX/Hnv6LKyp1s2+XSV0f6RTCQFM8pZ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VALID_EF, FREEMAIL_FROM, GIT_PATCH_0, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H2, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) 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: Harald Anlauf via Gcc-patches From: Harald Anlauf Reply-To: Harald Anlauf Errors-To: gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org Sender: "Gcc-patches" X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1757935430015259343?= X-GMAIL-MSGID: =?utf-8?q?1757935430015259343?= Dear all, I've committed the attached obvious and trivial patch for another NULL pointer dereference on behalf of Steve and after regtesting on x86_64-pc-linux-gnu as r13-6067-gc75cbeba81e5b4737a9ab7dd28cce650965535a9 Thanks, Harald From c75cbeba81e5b4737a9ab7dd28cce650965535a9 Mon Sep 17 00:00:00 2001 From: Steve Kargl Date: Wed, 15 Feb 2023 22:40:37 +0100 Subject: [PATCH] Fortran: error recovery on checking procedure argument intent [PR103608] gcc/fortran/ChangeLog: PR fortran/103608 * frontend-passes.cc (do_intent): Catch NULL pointer dereference on reference to invalid formal argument. gcc/testsuite/ChangeLog: PR fortran/103608 * gfortran.dg/pr103608.f90: New test. --- gcc/fortran/frontend-passes.cc | 3 ++- gcc/testsuite/gfortran.dg/pr103608.f90 | 14 ++++++++++++++ 2 files changed, 16 insertions(+), 1 deletion(-) create mode 100644 gcc/testsuite/gfortran.dg/pr103608.f90 diff --git a/gcc/fortran/frontend-passes.cc b/gcc/fortran/frontend-passes.cc index 1cbc63016da..02fcb41dbc4 100644 --- a/gcc/fortran/frontend-passes.cc +++ b/gcc/fortran/frontend-passes.cc @@ -3049,7 +3049,8 @@ do_intent (gfc_expr **e) do_sym = dl->ext.iterator->var->symtree->n.sym; if (a->expr && a->expr->symtree - && a->expr->symtree->n.sym == do_sym) + && a->expr->symtree->n.sym == do_sym + && f->sym) { if (f->sym->attr.intent == INTENT_OUT) gfc_error_now ("Variable %qs at %L set to undefined value " diff --git a/gcc/testsuite/gfortran.dg/pr103608.f90 b/gcc/testsuite/gfortran.dg/pr103608.f90 new file mode 100644 index 00000000000..5c37cb78dc6 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/pr103608.f90 @@ -0,0 +1,14 @@ +! { dg-do compile } +! { dg-options "-w" } +! PR fortran/103608 - ICE in do_intent +! Contributed by G.Steinmetz + +program p + implicit none + integer :: i + integer :: x ! { dg-error "Alternate return specifier" } + x(*) = 0 + do i = 1, 2 + print *, x(i) ! { dg-error "Missing alternate return specifier" } + end do +end -- 2.35.3