From patchwork Tue Dec 10 22:05:19 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Harald Anlauf X-Patchwork-Id: 1207315 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-515654-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="quNIoGpE"; dkim=pass (1024-bit key; secure) header.d=gmx.net header.i=@gmx.net header.b="eEE3uJb3"; 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 47XYz04q6mz9sRH for ; Wed, 11 Dec 2019 09:05: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; q= dns; s=default; b=ADlgJZMsx+bgGedDJEwK36xKIqwm35VDQYe2iHmQyG2FH+ 6imIJmVNs3rC8PWEFuSPfrfzV9SmDoOV3l5bTk+rljlZIrZDXlZa4/eJbYSXyLUI /KYZjmJTVT9mRpN4mpnW49Sd0cyHajWLmA5E+s4dlYPCmIO+tg2yzEiaEpQ7I= 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=6Z6cQKyKc/CQeQuPEfpPSTu0/Fk=; b=quNIoGpECjGNml+GkZd0 B55yv8lsvYTtBoqrarpqAyWoVla8YF+WqELcqy+ZDjqiAYe7DiAigcOZoARRU/BR NfG0h+XaNPM8zPyzYlqP3b4Neew1hqACirXUk1eT1AfKNfYvRDfJfattLH3UYyV9 DOkqGRlCwJfhDyI2DTrChiY= Received: (qmail 103090 invoked by alias); 10 Dec 2019 22:05:21 -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 103074 invoked by uid 89); 10 Dec 2019 22:05:21 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-8.8 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=exhibits, enhances, H*u:i686, H*UA:i686 X-HELO: mout.gmx.net Received: from mout.gmx.net (HELO mout.gmx.net) (212.227.15.15) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 10 Dec 2019 22:05:19 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=badeba3b8450; t=1576015516; bh=03GlZoThIr7rA0YVoJQ3rN6xsgbsDgIxC0/cwrA3iM4=; h=X-UI-Sender-Class:Date:From:To:Subject; b=eEE3uJb3lfaRePzIOGGwJVCfehg3Buz/aTSR0NQAed5QsVb6uv7FfS4niQR5JMhzz vHS/qarekN81z/RvWoFYiPVzcPk5a0R+qxlI6zDc9YG1j4EmbdlVmSs6kl/DRqjvgH LJTkg34nz252ZTWv0proR2c0/6kcFgEE9pqTI/c4= X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c Received: from proton.at.home ([79.251.14.25]) by mail.gmx.com (mrgmx005 [212.227.17.190]) with ESMTPSA (Nemesis) id 1MY68d-1iDfSz30En-00YQ38; Tue, 10 Dec 2019 23:05:16 +0100 Message-ID: <5DF0169F.8060308@gmx.de> Date: Tue, 10 Dec 2019 23:05:19 +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] PR92898 - [9/10 Regression] ICE in gfc_check_is_contiguous, at fortran/check.c:7157 The testcase in the PR exhibits a corner case in a check on invalid code that was not handled appropriately and in turn ICEs. The patch below enhances that check. Instead of adding a new testcase, I modified the related one that came with the 'introduction' of the regression when fixing PR91641. Regtested on x86_64-pc-linux-gnu. OK for trunk and 9 ? Thanks, Harald 2019-12-10 Harald Anlauf PR fortran/92898 * check.c (gfc_check_is_contiguous): Adjust check to handle NULL() argument without an actual argument. 2019-12-10 Harald Anlauf PR fortran/92898 * gfortran.dg/pr91641.f90: Extend to check fix for PR92898. Index: gcc/testsuite/gfortran.dg/pr91641.f90 =================================================================== --- gcc/testsuite/gfortran.dg/pr91641.f90 (Revision 279183) +++ gcc/testsuite/gfortran.dg/pr91641.f90 (Arbeitskopie) @@ -1,7 +1,9 @@ ! { dg-do compile } ! PR fortran/91641 -! Code conyributed by Gerhard Steinmetz +! PR fortran/92898 +! Code contributed by Gerhard Steinmetz program p real, pointer :: z(:) print *, is_contiguous (null(z)) ! { dg-error "shall be an associated" } + print *, is_contiguous (null()) ! { dg-error "shall be an associated" } end Index: gcc/fortran/check.c =================================================================== --- gcc/fortran/check.c (Revision 279183) +++ gcc/fortran/check.c (Arbeitskopie) @@ -7154,7 +7154,9 @@ bool gfc_check_is_contiguous (gfc_expr *array) { if (array->expr_type == EXPR_NULL - && array->symtree->n.sym->attr.pointer == 1) + && (!array->symtree || + (array->symtree->n.sym && + array->symtree->n.sym->attr.pointer == 1))) { gfc_error ("Actual argument at %L of %qs intrinsic shall be an " "associated pointer", &array->where, gfc_current_intrinsic);