From patchwork Thu Apr 1 13:44:01 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paul Richard Thomas X-Patchwork-Id: 1461053 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; 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=fQH2cnuM; 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 4FB4D36cVqz9sVq for ; Fri, 2 Apr 2021 00:44:19 +1100 (AEDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id AE501384B823; Thu, 1 Apr 2021 13:44:17 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org AE501384B823 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1617284657; bh=dCsO7EYLNh/3hJKafrllIX7r1QhEOWMdxe209/CTN6Y=; h=Date:Subject:To:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:From; b=fQH2cnuMgwVeTcX6U1DJjtFNP1zxS0rvLxhCwprm25ceAJ6BGJchKZduK4hFGsDLm 8BUAmphBQpC27nlTmNV8HSxwd3ib98K/0v3XaQsBwM0OunSgya2R0WFNozh4iahBIO trwd3g220gTSk9Z/5vuKEtElxY0/s5nOuKfyM4MA= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-lj1-x231.google.com (mail-lj1-x231.google.com [IPv6:2a00:1450:4864:20::231]) by sourceware.org (Postfix) with ESMTPS id 61A393858024; Thu, 1 Apr 2021 13:44:14 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 61A393858024 Received: by mail-lj1-x231.google.com with SMTP id 184so2301709ljf.9; Thu, 01 Apr 2021 06:44:14 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:from:date:message-id:subject:to; bh=Td5/W9zp60zAWtel+/MW/Ladq8CtfDRwHwyl9CbWctw=; b=BgYSoUP0HHvQmphE0MhEngXTjtYySg1MjMeHAtUMT7uJl2roRbIXg7/Wg9+XLTB5cz edRjMcXiTWeuS0TFjUaL1ZDU3Xw4qF+h2vMxBzecsoovIxgFesviwYrtflkpY+qES3Gg 2f+SXo5bScARvpvNKlHHK+TT9bcsDVZXizxiN7kXQidcOv23vQXfDCBQdK1pftejpJea yuKTb45jRelkY3WxP7bDS/efDg1PYnm2n7qd+xogc/BlaAUnpo8Rp38D4YIX6zdbtl2B vzXz1GZ0CFolW2nCuQoT/gt/fV9qcT9p2NeFqzZ05liCCBtspCduIR3+f9fht2/HYOlt ziPw== X-Gm-Message-State: AOAM531nYB06ppdDY1sZb9shUl16yT68NiqX1UXjncfRcfFj4hrfN5Z1 YMqbl1dKZLqZ5fwX0wJbsOl3AdBF+3u3NHnEBKxCm50UYVg= X-Google-Smtp-Source: ABdhPJzOqn76yXrd3YWZhLyCT/q+jk91+GjIzogsYn2NbVSLPUszG9SHbpuohHomCfUK70QB2dEHqXDyFGiGDpDtKAY= X-Received: by 2002:a05:651c:39d:: with SMTP id e29mr5517951ljp.259.1617284652536; Thu, 01 Apr 2021 06:44:12 -0700 (PDT) MIME-Version: 1.0 Date: Thu, 1 Apr 2021 14:44:01 +0100 Message-ID: Subject: [Patch, fortran] PR99818 - [10/11 Regression] ICE in gfc_get_tree_for_caf_expr, at fortran/trans-expr.c:2186 To: "fortran@gcc.gnu.org" , gcc-patches X-Spam-Status: No, score=-8.5 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, GIT_PATCH_0, HTML_MESSAGE, KAM_NUMSUBJECT, RCVD_IN_DNSWL_NONE, 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-Content-Filtered-By: Mailman/MimeDel 2.1.29 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: Paul Richard Thomas via Gcc-patches From: Paul Richard Thomas Reply-To: Paul Richard Thomas Errors-To: gcc-patches-bounces@gcc.gnu.org Sender: "Gcc-patches" This one is trivial. The wrong error message was transformed by my patch for PR98897 into an ICE. This patch now produces the correct error. Regtests OK on FC33/x86_64 - OK for the affected branches? Paul Fortran: Fix ICE on wrong code [PR99818]. 2021-04-01 Paul Thomas gcc/fortran/ChangeLog PR fortran/99818 * interface.c (compare_parameter): The codimension attribute is applied to the _data field of class formal arguments. gcc/testsuite/ChangeLog PR fortran/99818 * gfortran.dg/coarray_48.f90: New test. diff --git a/gcc/fortran/interface.c b/gcc/fortran/interface.c index f7ca52e6550..60736123550 100644 --- a/gcc/fortran/interface.c +++ b/gcc/fortran/interface.c @@ -2327,6 +2327,7 @@ compare_parameter (gfc_symbol *formal, gfc_expr *actual, bool rank_check, is_pointer; char err[200]; gfc_component *ppc; + bool codimension = false; /* If the formal arg has type BT_VOID, it's to one of the iso_c_binding procs c_f_pointer or c_f_procpointer, and we need to accept most @@ -2490,7 +2491,12 @@ compare_parameter (gfc_symbol *formal, gfc_expr *actual, return false; } - if (formal->attr.codimension && !gfc_is_coarray (actual)) + if (formal->ts.type == BT_CLASS && formal->attr.class_ok) + codimension = CLASS_DATA (formal)->attr.codimension; + else + codimension = formal->attr.codimension; + + if (codimension && !gfc_is_coarray (actual)) { if (where) gfc_error ("Actual argument to %qs at %L must be a coarray", @@ -2498,7 +2504,7 @@ compare_parameter (gfc_symbol *formal, gfc_expr *actual, return false; } - if (formal->attr.codimension && formal->attr.allocatable) + if (codimension && formal->attr.allocatable) { gfc_ref *last = NULL; @@ -2520,7 +2526,7 @@ compare_parameter (gfc_symbol *formal, gfc_expr *actual, } } - if (formal->attr.codimension) + if (codimension) { /* F2008, 12.5.2.8 + Corrig 2 (IR F08/0048). */ /* F2018, 12.5.2.8. */ @@ -2586,7 +2592,7 @@ compare_parameter (gfc_symbol *formal, gfc_expr *actual, return false; } - if (formal->attr.allocatable && !formal->attr.codimension + if (formal->attr.allocatable && !codimension && actual_attr.codimension) { if (formal->attr.intent == INTENT_OUT)