From patchwork Sun Jan 16 21:21:42 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mikael Morin X-Patchwork-Id: 50091 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 27A23385842C for ; Sun, 16 Jan 2022 21:26:01 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 27A23385842C DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1642368361; bh=NtxDKBkli4rGqKPHvlWxi+/i+uMxrBLwXoyYXp2eCpk=; h=To:Subject:Date:In-Reply-To:References:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: From; b=ZdFMXkwqldkWyubfYEQXO1chco1KXtNkNeUWn9hlR36QCUN6wk14xOd9HGsHSqEzb 6DDhsZ1BB7MJW3EG9p5de4BHf7fuktpEFaTtviV7Cs5H1MCIgq8nxTi3OsAw3OZTYO hOpzxE2fAg/WXrZudac2s+nDjQ0qcigxzIq/Y2OA= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from smtp.smtpout.orange.fr (smtp09.smtpout.orange.fr [80.12.242.131]) by sourceware.org (Postfix) with ESMTPS id DCF11385843E for ; Sun, 16 Jan 2022 21:22:14 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org DCF11385843E Received: from cyrano.home ([86.253.179.215]) by smtp.orange.fr with ESMTPA id 9CyCngBkTAWDQ9Cybn67S2; Sun, 16 Jan 2022 22:22:14 +0100 X-ME-Helo: cyrano.home X-ME-Auth: MDU4MTIxYWM4YWI0ZGE4ZTUwZWZmNTExZmI2ZWZlMThkM2ZhYiE5OWRkOGM= X-ME-Date: Sun, 16 Jan 2022 22:22:14 +0100 X-ME-IP: 86.253.179.215 To: fortran@gcc.gnu.org, gcc-patches@gcc.gnu.org Subject: [pushed 2/3] Fortran: Ignore KIND argument of a few more intrinsics. [PR103789] Date: Sun, 16 Jan 2022 22:21:42 +0100 Message-Id: <20220116212143.1901964-3-mikael@gcc.gnu.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220116212143.1901964-1-mikael@gcc.gnu.org> References: <20220116212143.1901964-1-mikael@gcc.gnu.org> MIME-Version: 1.0 X-Spam-Status: No, score=-10.6 required=5.0 tests=BAYES_00, GIT_PATCH_0, JMQ_SPF_NEUTRAL, KAM_DMARC_STATUS, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, SPF_HELO_NONE, SPF_NEUTRAL, TXREP autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) 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: Mikael Morin via Gcc-patches From: Mikael Morin Reply-To: Mikael Morin Errors-To: gcc-patches-bounces+patchwork=sourceware.org@gcc.gnu.org Sender: "Gcc-patches" After PR97896 for which some code was added to ignore the KIND argument of the INDEX intrinsics, and PR87711 for which that was extended to LEN_TRIM as well, this propagates it further to MASKL, MASKR, SCAN and VERIFY. PR fortran/103789 gcc/fortran/ChangeLog: * trans-array.c (arg_evaluated_for_scalarization): Add MASKL, MASKR, SCAN and VERIFY to the list of intrinsics whose KIND argument is to be ignored. gcc/testsuite/ChangeLog: * gfortran.dg/maskl_1.f90: New test. * gfortran.dg/maskr_1.f90: New test. * gfortran.dg/scan_3.f90: New test. * gfortran.dg/verify_3.f90: New test. (cherry picked from commit c1c17a43e172ebc28f2cd247f6e83c5fdbc6219f) --- gcc/fortran/trans-array.c | 4 ++++ gcc/testsuite/gfortran.dg/maskl_1.f90 | 10 ++++++++++ gcc/testsuite/gfortran.dg/maskr_1.f90 | 10 ++++++++++ gcc/testsuite/gfortran.dg/scan_3.f90 | 11 +++++++++++ gcc/testsuite/gfortran.dg/verify_3.f90 | 11 +++++++++++ 5 files changed, 46 insertions(+) create mode 100644 gcc/testsuite/gfortran.dg/maskl_1.f90 create mode 100644 gcc/testsuite/gfortran.dg/maskr_1.f90 create mode 100644 gcc/testsuite/gfortran.dg/scan_3.f90 create mode 100644 gcc/testsuite/gfortran.dg/verify_3.f90 diff --git a/gcc/fortran/trans-array.c b/gcc/fortran/trans-array.c index e187a08f8f0..308213c57e3 100644 --- a/gcc/fortran/trans-array.c +++ b/gcc/fortran/trans-array.c @@ -11225,11 +11225,15 @@ arg_evaluated_for_scalarization (gfc_intrinsic_sym *function, switch (function->id) { case GFC_ISYM_INDEX: + case GFC_ISYM_SCAN: + case GFC_ISYM_VERIFY: if (arg_num == 3) return false; break; case GFC_ISYM_LEN_TRIM: + case GFC_ISYM_MASKL: + case GFC_ISYM_MASKR: if (arg_num == 1) return false; diff --git a/gcc/testsuite/gfortran.dg/maskl_1.f90 b/gcc/testsuite/gfortran.dg/maskl_1.f90 new file mode 100644 index 00000000000..9e25c2c9cdc --- /dev/null +++ b/gcc/testsuite/gfortran.dg/maskl_1.f90 @@ -0,0 +1,10 @@ +! { dg-do compile } +! +! PR fortran/103789 +! Check the absence of ICE when generating calls to MASKL with a KIND argument. + +program p + integer :: z(2), y(2) + y = [1, 13] + z = maskl(y, kind=4) + 1 +end program p diff --git a/gcc/testsuite/gfortran.dg/maskr_1.f90 b/gcc/testsuite/gfortran.dg/maskr_1.f90 new file mode 100644 index 00000000000..ebfd3dbba33 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/maskr_1.f90 @@ -0,0 +1,10 @@ +! { dg-do compile } +! +! PR fortran/103789 +! Check the absence of ICE when generating calls to MASKR with a KIND argument. + +program p + integer :: z(2), y(2) + y = [1, 13] + z = maskr(y, kind=4) + 1 +end program p diff --git a/gcc/testsuite/gfortran.dg/scan_3.f90 b/gcc/testsuite/gfortran.dg/scan_3.f90 new file mode 100644 index 00000000000..80262ae2167 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/scan_3.f90 @@ -0,0 +1,11 @@ +! { dg-do compile } +! +! PR fortran/103789 +! Check the absence of ICE when generating calls to SCAN with a KIND argument. + +program p + character(len=10) :: y(2) + integer :: z(2) + y = ['abc', 'def'] + z = scan(y, 'e', kind=4) + 1 +end program p diff --git a/gcc/testsuite/gfortran.dg/verify_3.f90 b/gcc/testsuite/gfortran.dg/verify_3.f90 new file mode 100644 index 00000000000..f01e24e199e --- /dev/null +++ b/gcc/testsuite/gfortran.dg/verify_3.f90 @@ -0,0 +1,11 @@ +! { dg-do compile } +! +! PR fortran/103789 +! Check the absence of ICE when generating calls to VERIFY with a KIND argument. + +program p + character(len=10) :: y(2) + integer :: z(2) + y = ['abc', 'def'] + z = verify(y, 'e', kind=4) + 1 +end program p