* [PATCH] Fortran: Fix ICE in argument_rank_mismatch [PR103287]
@ 2022-01-05 21:34 Sandra Loosemore
2022-01-06 19:47 ` Harald Anlauf
0 siblings, 1 reply; 3+ messages in thread
From: Sandra Loosemore @ 2022-01-05 21:34 UTC (permalink / raw)
To: fortran; +Cc: gcc-patches, Steve Kargl
[-- Attachment #1: Type: text/plain, Size: 230 bytes --]
One of my previous TS29113-related patches from last fall introduced an
ICE due to a bogus assertion. This is the fix Steve suggested in the
issue, bundled with the test cases, regression-tested, etc. OK to check in?
-Sandra
[-- Attachment #2: pr103287.patch --]
[-- Type: text/x-patch, Size: 2198 bytes --]
commit beaae3933ef62e4d52ec22c14a308295c0794683
Author: Sandra Loosemore <sandra@codesourcery.com>
Date: Wed Jan 5 13:18:10 2022 -0800
Fortran: Fix ICE in argument_rank_mismatch [PR103287]
This patch removes an incorrect assertion. A user-friendly error for this
case is already given elsewhere.
2022-01-05 Steve Kargl <kargl@gcc.gnu.org>
Sandra Loosemore <sandra@codesourcery.com>
PR fortran/103287
gcc/fortran/
* interface.c (argument_rank_mismatch): Replace incorrect assertion
with return.
gcc/testsuite/
* gfortran.dg/c-interop/pr103287-1.f90: new.
* gfortran.dg/c-interop/pr103287-2.f90: new.
diff --git a/gcc/fortran/interface.c b/gcc/fortran/interface.c
index 4be9583..0fd881d 100644
--- a/gcc/fortran/interface.c
+++ b/gcc/fortran/interface.c
@@ -2237,7 +2237,11 @@ argument_rank_mismatch (const char *name, locus *where,
}
else
{
- gcc_assert (rank2 != -1);
+ if (rank2 == -1)
+ /* This is an assumed rank-actual passed to a function without
+ an explicit interface, which is already diagnosed in
+ gfc_procedure_use. */
+ return;
if (rank1 == 0)
gfc_error_opt (0, "Rank mismatch between actual argument at %L "
"and actual argument at %L (scalar and rank-%d)",
diff --git a/gcc/testsuite/gfortran.dg/c-interop/pr103287-1.f90 b/gcc/testsuite/gfortran.dg/c-interop/pr103287-1.f90
new file mode 100644
index 0000000..aeca52f
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/c-interop/pr103287-1.f90
@@ -0,0 +1,9 @@
+! { dg-do compile }
+
+subroutine g
+ call s([1])
+end
+subroutine h(x)
+ integer, pointer :: x(..)
+ call s(x) ! { dg-error "Assumed-rank argument requires an explicit interface" }
+end
diff --git a/gcc/testsuite/gfortran.dg/c-interop/pr103287-2.f90 b/gcc/testsuite/gfortran.dg/c-interop/pr103287-2.f90
new file mode 100644
index 0000000..0e724b8
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/c-interop/pr103287-2.f90
@@ -0,0 +1,9 @@
+! { dg-do compile }
+
+subroutine g
+ call s(1)
+end
+subroutine h(x)
+ integer, pointer :: x(..)
+ call s(x) ! { dg-error "Assumed-rank argument requires an explicit interface" }
+end
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] Fortran: Fix ICE in argument_rank_mismatch [PR103287]
2022-01-05 21:34 [PATCH] Fortran: Fix ICE in argument_rank_mismatch [PR103287] Sandra Loosemore
@ 2022-01-06 19:47 ` Harald Anlauf
2022-01-06 19:47 ` Harald Anlauf
0 siblings, 1 reply; 3+ messages in thread
From: Harald Anlauf @ 2022-01-06 19:47 UTC (permalink / raw)
To: fortran; +Cc: gcc-patches
Am 05.01.22 um 22:34 schrieb Sandra Loosemore:
> One of my previous TS29113-related patches from last fall introduced an
> ICE due to a bogus assertion. This is the fix Steve suggested in the
> issue, bundled with the test cases, regression-tested, etc. OK to check
> in?
OK.
> -Sandra
Thanks,
Harald
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] Fortran: Fix ICE in argument_rank_mismatch [PR103287]
2022-01-06 19:47 ` Harald Anlauf
@ 2022-01-06 19:47 ` Harald Anlauf
0 siblings, 0 replies; 3+ messages in thread
From: Harald Anlauf @ 2022-01-06 19:47 UTC (permalink / raw)
To: Sandra Loosemore, fortran; +Cc: gcc-patches, Steve Kargl
Am 05.01.22 um 22:34 schrieb Sandra Loosemore:
> One of my previous TS29113-related patches from last fall introduced an
> ICE due to a bogus assertion. This is the fix Steve suggested in the
> issue, bundled with the test cases, regression-tested, etc. OK to check
> in?
OK.
> -Sandra
Thanks,
Harald
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2022-01-06 19:47 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-01-05 21:34 [PATCH] Fortran: Fix ICE in argument_rank_mismatch [PR103287] Sandra Loosemore
2022-01-06 19:47 ` Harald Anlauf
2022-01-06 19:47 ` Harald Anlauf
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).