From patchwork Wed Dec 18 16:07:16 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Harald Anlauf X-Patchwork-Id: 1212548 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=209.132.180.131; helo=sourceware.org; envelope-from=gcc-patches-return-516243-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="n9ouiPw3"; dkim=pass (1024-bit key; secure) header.d=gmx.net header.i=@gmx.net header.b="TWKoeXYv"; 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 47dKfG5NVQz9sS9 for ; Thu, 19 Dec 2019 03:07:32 +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 :content-transfer-encoding; q=dns; s=default; b=G5To/LbO3cS01nfz yhOFQ4e+l1otvuOLjo574BUMY9uxbb4NgJXP0V1NDrXhxVGLfPLBoUr36y9gw3XV ytZlJbs8o2M3MSpDWUVT8qZDlcxwR/SpaYlmOAe926NXrwN3rI2+jycC/1qm/pOU yxPt+ys0qj/tWRfBQr+xl9xS55w= 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 :content-transfer-encoding; s=default; bh=1fSRe5BRqwD4T8+mvMCMvJ bN/FQ=; b=n9ouiPw38WWVMp2c5LlfyclRNj1XgyoTF/zzJYoYkTlgP6TOMZU/9S SCOH6iCGc3Ocb24aEGnhq1x6fs8WTRGIr1ZLVWuaAkzcb8u610inGqDBgMAqv65r yrrimNXNnc723316+3WIqi43oKv08oq0l+EqSIf2hLc4Cx8YwWxaI= Received: (qmail 79792 invoked by alias); 18 Dec 2019 16:07:22 -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 79778 invoked by uid 89); 18 Dec 2019 16:07:21 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-9.1 required=5.0 tests=AWL, BAYES_00, FREEMAIL_FROM, GIT_PATCH_2, GIT_PATCH_3, KAM_ASCII_DIVIDERS, KAM_NUMSUBJECT, RCVD_IN_DNSWL_NONE, SPF_PASS autolearn=ham version=3.3.1 spammy=nicht, H*u:i686, H*UA:i686 X-HELO: mout.gmx.net Received: from mout.gmx.net (HELO mout.gmx.net) (212.227.15.18) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 18 Dec 2019 16:07:20 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=badeba3b8450; t=1576685237; bh=/EBYYWJfr/jO9N4LbDItB3g60lZrFg+ebXlKk0/w3Uo=; h=X-UI-Sender-Class:Date:From:To:Subject; b=TWKoeXYvUUF4f26tKudVQ7RgWiTfm0LsqREn0QgDgf6aKxviATIPCSJrBvgXdRC1U s5lkkmouiAw5/C3NrobgVjop48yXxI430MqLan2ZWLHqkQGDzf1JVVvA8SWPebcAhV yi59k6FBe14of3XkZQSiIPYen0wqBFrDneHJcB7A= X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c Received: from proton.at.home ([93.207.83.161]) by mail.gmx.com (mrgmx005 [212.227.17.190]) with ESMTPSA (Nemesis) id 1MDQiS-1iZO6t1zTq-00AXSi; Wed, 18 Dec 2019 17:07:17 +0100 Message-ID: <5DFA4EB4.4040805@gmx.de> Date: Wed, 18 Dec 2019 17:07:16 +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: [Patch, fortran] PR70853 - ICE on pointing to null, in gfc_add_block_to_block, at fortran/trans.c:1599 The patch is self-explaining and practically obvious: pointer bounds remapping to NULL is not allowed, thus we shall reject it. I hope the error message is fine. If somebody prefers a formulation as in the standard ("data target", also used by the Intel compiler), please speak now. Regtested on x86_64-pc-linux-gnu. OK for trunk? Thanks, Harald 2019-12-18 Harald Anlauf PR fortran/92898 * trans-expr.c (gfc_trans_pointer_assignment): Reject bounds remapping if pointer target is NULL(). 2019-12-18 Harald Anlauf PR fortran/70853 * gfortran.dg/pr70853.f90: New test. Index: gcc/fortran/trans-expr.c =================================================================== --- gcc/fortran/trans-expr.c (Revision 279405) +++ gcc/fortran/trans-expr.c (Arbeitskopie) @@ -9218,6 +9218,13 @@ gfc_trans_pointer_assignment (gfc_expr * expr1, gf break; rank_remap = (remap && remap->u.ar.end[0]); + if (remap && expr2->expr_type == EXPR_NULL) + { + gfc_error ("If bounds remapping is specified at %L, " + "the pointer target shall not be NULL", &expr1->where); + return NULL_TREE; + } + gfc_init_se (&lse, NULL); if (remap) lse.descriptor_only = 1; Index: gcc/testsuite/gfortran.dg/pr70853.f90 =================================================================== --- gcc/testsuite/gfortran.dg/pr70853.f90 (nicht existent) +++ gcc/testsuite/gfortran.dg/pr70853.f90 (Arbeitskopie) @@ -0,0 +1,8 @@ +! { dg-do compile } +! PR fortran/70853 +! Contributed by Gerhard Steinmetz +program p + real, pointer :: z(:) + z(1:2) => null() ! { dg-error "pointer target shall not be NULL" } + z(2:1) => null() ! { dg-error "pointer target shall not be NULL" } +end