From patchwork Tue Jun 11 14:12:38 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andre Vehreschild X-Patchwork-Id: 1946355 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; secure) header.d=gmx.de header.i=vehre@gmx.de header.a=rsa-sha256 header.s=s31663417 header.b=OvyawW6W; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=2620:52:3:1:0:246e:9693:128c; helo=server2.sourceware.org; envelope-from=gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=patchwork.ozlabs.org) Received: from server2.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 ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4Vz9cl0wd2z1ydW for ; Wed, 12 Jun 2024 00:13:11 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 56CB9385DC3C for ; Tue, 11 Jun 2024 14:13:09 +0000 (GMT) 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.15]) by sourceware.org (Postfix) with ESMTPS id 86EAB3858C5F; Tue, 11 Jun 2024 14:12:42 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 86EAB3858C5F Authentication-Results: sourceware.org; dmarc=pass (p=quarantine dis=none) header.from=gmx.de Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmx.de ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 86EAB3858C5F Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=212.227.15.15 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1718115167; cv=none; b=qqvgrGPPUT9R7fd8reONoeEkCnpAdijmkI15KMZUYOfkm5yYV1jbVwp67Stule7wYHogaZ5utr/cLu4LkcK68lXIscYcqhLBTiNtXh0biFpPrXEMZGiU01UUS3QBBRy7jU4dexRR3TP4F6svFG0/hQ7aJS++Q6RkZEU3FxYfVNw= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1718115167; c=relaxed/simple; bh=QVeDhyCsUeEOVhfALW5L2HZ5BuLTDVcViXgQytlNZRY=; h=DKIM-Signature:Date:From:To:Subject:Message-ID:MIME-Version; b=BBUV3vrB5b4UNBXKJ6g+7q993/NACU9m+p3sPUi44vfhOYakDs8NQoZ4Yit4E3dp+i2nowwbcrayapL56Wl/CjbulMoUOKBh1oZcIMWqT02INI6SG+wTzLR/Xy3gLGUp3uhJ3SZcdPx8fWosrRtwrp8YFaUWyWYVnbzbhlgXu1I= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmx.de; s=s31663417; t=1718115161; x=1718719961; i=vehre@gmx.de; bh=bpegcUAA6eBU2tEKj0rDXbW4OGSzlPEKaBklU6VsdO8=; h=X-UI-Sender-Class:Date:From:To:Subject:Message-ID:MIME-Version: Content-Type:cc:content-transfer-encoding:content-type:date:from: message-id:mime-version:reply-to:subject:to; b=OvyawW6Wt47oGsF6SaIKGUclRlYvYhbY9VaLCEYetTadSq8/ldw6bhLQXKPgV3jY Ok7kiW0oNXLOGNwlb2wsEzJYrcZfZbgzx/aFVdBtBLh/8mdMWnN/7eWYEZ85D55bJ epmDdzfqI3MuIfCoxc9N+ANQbxG9XipfQJlQZG+p+3CzFMcJQXFoMaDd36sXvKFFy P7qDlq4tso/klpsQY/PdcdiG1o5EdtjgxAG1dM9dPSEf/BOmdmmU911v3ffCRbXeP zbyu4xySnlA5Ef7VAIDHSZgbhbDiNaBL/6WtR9uMEf6G73gzZAN+IdW1C+9FB86jg uNuhnLhEEWn8np+u+w== X-UI-Sender-Class: 724b4f7f-cbec-4199-ad4e-598c01a50d3a Received: from vepi2 ([62.155.205.192]) by mail.gmx.net (mrgmx004 [212.227.17.190]) with ESMTPSA (Nemesis) id 1MuUj2-1sZFc244eY-00rvbj; Tue, 11 Jun 2024 16:12:41 +0200 Date: Tue, 11 Jun 2024 16:12:38 +0200 From: Andre Vehreschild To: GCC-Patches-ML , GCC-Fortran-ML Subject: [Patch, Fortran, 96418] Fix Test coarray_alloc_comp_4.f08 ICEs Message-ID: <20240611161238.14634f57@vepi2> X-Mailer: Claws Mail 4.2.0 (GTK 3.24.41; x86_64-redhat-linux-gnu) MIME-Version: 1.0 X-Provags-ID: V03:K1:R1Gz18Hz89loXartCdnWgIWz9pqgbbvMyjul8bBPL1NOX7Pe9v1 nfOE57WuOZjYuJcSAhfWQPAMXETZpHt5F/+7i9U8i8ZZK0uLwk7cf/0nq5/7jQ8xvNroybx Ddt/6ZSMx+vFq2ebJBJDlD+GoDmnRAv87zZp4AgRNRSSRllyatoRBeVmdBXY4azeYNuy7xr GKAeSvGqtP40nPzRLuplw== UI-OutboundReport: notjunk:1;M01:P0:ZfqDYn8j+RY=;zfodoa/J54949trHwtjgmiG527d d8dZjIou0JLP9KpBxjPeJqnYQBMs2va/pRTjWrVXUCVXW/f1LT//lxNCpPzEkaTlu+o+LKX8n u2J3shFbdsLT4Y5cpnoyLCztfxU/gpYiHUzR+av9qfUcJMhC/tmDlSvu9ybaZRo3lXGePZAvX A14hUIc1E42uZCxu9mNvOCC//VeEqHSKjdJQFyGI1DPFS1Du+3BSwqjZLCaXSxubaM6WStjx8 +yNAFzn6krkaIwvfMNngLHRdH63KQ8tjiwpN6pnU7xxjU9KHIo+GLYNo1DqzJlnBrWeBKUuGR yNkVhNZD16+X9/u4izdBb9PgcFcvpaPys3KdJ8IURD4XvBEhMZscv8RB+EgjvGRXWjJ1QQ9NE Y0nfoSP454JGjvUR4n4t1NESjkwOufSY/Rk/VfI4198vEfkd3di00w9yijU6ml+XU/KaJ1z2a x/pn8xRDZLPFsfGOhv04APTdXsCabsOE+JW8wWE5lgvEsHOzvYXUOMHYcHqPxYg7c/wjFmPFQ C96MYLdPXaSKLptx7RVw0iHrlhdf2mPqsruy82ApCVooagrSFVeJ1yGaX7OhF8H76eRg+Fg/y VxeY8V1i0eyVKawUMZuuAZHEVOMwWwWKepjqRVz2DRbZrdU17CtJ6p1GNEIYmOT14AGDvq2y2 EtGSFJXMgY0fjWIkf6VymYITKKBSj8iDVZOL3yDsgmvJ0ZpI1vS+wehjNNJO07Bjcy3oI0BL0 ZmTgJx8k/8iPIwQ2YI8Quh+k+64LGzur2ilvb3eRerBAaFWhFZ4HpgDdXrUZD05lfyU1YTOCk gP0ouEt2KAnLfeIN0Lvj1PoYoTCJI60YvG7p95PR8hqCU= X-Spam-Status: No, score=-10.8 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, GIT_PATCH_0, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H4, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE 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.30 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org Hi all, attached patch has already been present in 2020, but lost my attention. It fixes an ICE in the testsuite. The old mails description is: attached patch fixes PR96418 where the code in the testsuite when compiled with -fcoarray=single lead to an ICE. The reason was that the coarray object was derefed as an array, but it was no array. Introducing the test for the descriptor removes the ICE. Regtests ok on x86_64-linux/Fedora 39. Ok for mainline? Regards, Andre --- Andre Vehreschild * Email: vehre ad gmx dot de From e56f32ed836c1ecc2b46497d1d7b9c7c08749521 Mon Sep 17 00:00:00 2001 From: Andre Vehreschild Date: Tue, 11 Jun 2024 15:24:55 +0200 Subject: [PATCH] Fix ICE when compiling with -fcoarray=single, when derefing a non-array. PR fortran/96418 gcc/fortran/ChangeLog: * trans.c (gfc_deallocate_with_status): Check that object to deref is an array, before applying array deref. gcc/testsuite/ChangeLog: * gfortran.dg/coarray_alloc_comp_3.f08: Moved to... * gfortran.dg/coarray/alloc_comp_6.f90: ...here. Should be tested for both -fcoarray=single and lib, resp. * gfortran.dg/coarray_alloc_comp_4.f08: Fix program name. --- gcc/fortran/trans.cc | 3 ++- .../{coarray_alloc_comp_3.f08 => coarray/alloc_comp_6.f08} | 3 +-- gcc/testsuite/gfortran.dg/coarray_alloc_comp_4.f08 | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) rename gcc/testsuite/gfortran.dg/{coarray_alloc_comp_3.f08 => coarray/alloc_comp_6.f08} (95%) diff --git a/gcc/fortran/trans.cc b/gcc/fortran/trans.cc index a208afe90ab..1335b8cc48b 100644 --- a/gcc/fortran/trans.cc +++ b/gcc/fortran/trans.cc @@ -1838,7 +1838,8 @@ gfc_deallocate_with_status (tree pointer, tree status, tree errmsg, else caf_dereg_type = (enum gfc_coarray_deregtype) coarray_dealloc_mode; } - else if (flag_coarray == GFC_FCOARRAY_SINGLE) + else if (flag_coarray == GFC_FCOARRAY_SINGLE + && GFC_DESCRIPTOR_TYPE_P (TREE_TYPE (pointer))) pointer = gfc_conv_descriptor_data_get (pointer); } else if (GFC_DESCRIPTOR_TYPE_P (TREE_TYPE (pointer))) diff --git a/gcc/testsuite/gfortran.dg/coarray_alloc_comp_3.f08 b/gcc/testsuite/gfortran.dg/coarray/alloc_comp_6.f08 similarity index 95% rename from gcc/testsuite/gfortran.dg/coarray_alloc_comp_3.f08 rename to gcc/testsuite/gfortran.dg/coarray/alloc_comp_6.f08 index e2037aa5809..8b153925129 100644 --- a/gcc/testsuite/gfortran.dg/coarray_alloc_comp_3.f08 +++ b/gcc/testsuite/gfortran.dg/coarray/alloc_comp_6.f08 @@ -1,12 +1,11 @@ ! { dg-do run } -! { dg-options "-fcoarray=lib -lcaf_single" } ! { dg-additional-options "-latomic" { target libatomic_available } } ! ! Contributed by Andre Vehreschild ! Check that manually freeing components does not lead to a runtime crash, ! when the auto-deallocation is taking care. -program coarray_alloc_comp_3 +program alloc_comp_6 implicit none type dt diff --git a/gcc/testsuite/gfortran.dg/coarray_alloc_comp_4.f08 b/gcc/testsuite/gfortran.dg/coarray_alloc_comp_4.f08 index 6586ec651dd..4c71a90af8f 100644 --- a/gcc/testsuite/gfortran.dg/coarray_alloc_comp_4.f08 +++ b/gcc/testsuite/gfortran.dg/coarray_alloc_comp_4.f08 @@ -5,7 +5,7 @@ ! Contributed by Andre Vehreschild ! Check that sub-components are caf_deregistered and not freed. -program coarray_alloc_comp_3 +program coarray_alloc_comp_4 implicit none type dt -- 2.45.1