* [PATCH] Fortran: Ignore KIND argument of a few more intrinsics. [PR103789]
@ 2022-01-09 14:10 Mikael Morin
2022-01-09 17:17 ` Mikael Morin
0 siblings, 1 reply; 2+ messages in thread
From: Mikael Morin @ 2022-01-09 14:10 UTC (permalink / raw)
To: gcc-patches, gfortran
[-- Attachment #1: Type: text/plain, Size: 293 bytes --]
Hello,
I was about to commit the attached patch, but pulling the latest master
brought me a broken bootstrap, so I can’t test it fully right now.
Anyway, it should be non-controversial, and Harald OK'ed a variant in the
PR already.
Bootstrap and regression test and commit pending.
Mikael
[-- Attachment #2: 0001-Fortran-Ignore-KIND-argument-of-a-few-more-intrinsic.patch --]
[-- Type: text/x-patch, Size: 3762 bytes --]
From c1c17a43e172ebc28f2cd247f6e83c5fdbc6219f Mon Sep 17 00:00:00 2001
From: Mikael Morin <mikael@gcc.gnu.org>
Date: Fri, 7 Jan 2022 22:34:59 +0100
Subject: [PATCH] Fortran: Ignore KIND argument of a few more intrinsics. [PR103789]
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.
---
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 29d08732e1b..a77f3318846 100644
--- a/gcc/fortran/trans-array.c
+++ b/gcc/fortran/trans-array.c
@@ -11500,6 +11500,10 @@ arg_evaluated_for_scalarization (gfc_intrinsic_sym *function,
{
case GFC_ISYM_INDEX:
case GFC_ISYM_LEN_TRIM:
+ case GFC_ISYM_MASKL:
+ case GFC_ISYM_MASKR:
+ case GFC_ISYM_SCAN:
+ case GFC_ISYM_VERIFY:
if (strcmp ("kind", gfc_dummy_arg_get_name (*dummy_arg)) == 0)
return false;
/* Fallthrough. */
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
--
2.34.1
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] Fortran: Ignore KIND argument of a few more intrinsics. [PR103789]
2022-01-09 14:10 [PATCH] Fortran: Ignore KIND argument of a few more intrinsics. [PR103789] Mikael Morin
@ 2022-01-09 17:17 ` Mikael Morin
0 siblings, 0 replies; 2+ messages in thread
From: Mikael Morin @ 2022-01-09 17:17 UTC (permalink / raw)
To: gcc-patches, gfortran
Le 09/01/2022 à 15:10, Mikael Morin a écrit :
> pulling the latest master brought me a broken bootstrap
>
It was a user error (of course).
> Bootstrap and regression test and commit pending.
>
Now tested and committed as
r12-6386-gc1c17a43e172ebc28f2cd247f6e83c5fdbc6219f
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2022-01-09 17:17 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-01-09 14:10 [PATCH] Fortran: Ignore KIND argument of a few more intrinsics. [PR103789] Mikael Morin
2022-01-09 17:17 ` Mikael Morin
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).