* Fortran : ICE in generic_correspondence PR95584
@ 2020-06-25 6:33 Mark Eggleston
2020-06-30 13:02 ` [PATCH] " Mark Eggleston
2020-06-30 13:27 ` Thomas Koenig
0 siblings, 2 replies; 3+ messages in thread
From: Mark Eggleston @ 2020-06-25 6:33 UTC (permalink / raw)
To: gcc-patches, fortran
[-- Attachment #1: Type: text/plain, Size: 629 bytes --]
Please find attached fix for PR95584. Original patch by Steve Kargl.
OK to commit and backport?
Commit message:
Fortran : ICE in generic_correspondence PR95584
Output an error for ambiguous interfaces in generic interface
instead of ICE.
2020-06-25 Steven G. Kargl <kargl@gcc.gnu.org>
gcc/fortran/
PR fortran/95584
* interface.c (generic_correspondence): Only use the pointer
to a symbol if exists.
2020-06-25 Mark Eggleston <markeggleston@gcc.gnu.org>
gcc/testsuite/
PR fortran/95584
* gfortran.dg/pr95584.f90: New test.
--
https://www.codethink.co.uk/privacy.html
[-- Attachment #2: 0001-Fortran-ICE-in-generic_correspondence-PR95584.patch --]
[-- Type: text/x-patch, Size: 1937 bytes --]
From 1205be65bd7c3aff52c2a9a00f298afa7aa0bf08 Mon Sep 17 00:00:00 2001
From: Mark Eggleston <markeggleston@gcc.gnu.org>
Date: Thu, 25 Jun 2020 05:16:50 +0100
Subject: [PATCH] Fortran : ICE in generic_correspondence PR95584
Output an error for ambiguous interfaces in generic interface
instead of ICE.
2020-06-25 Steven G. Kargl <kargl@gcc.gnu.org>
gcc/fortran/
PR fortran/95584
* interface.c (generic_correspondence): Only use the pointer
to a symbol if exists.
2020-06-25 Mark Eggleston <markeggleston@gcc.gnu.org>
gcc/testsuite/
PR fortran/95584
* gfortran.dg/pr95584.f90: New test.
---
gcc/fortran/interface.c | 2 +-
gcc/testsuite/gfortran.dg/pr95584.f90 | 16 ++++++++++++++++
2 files changed, 17 insertions(+), 1 deletion(-)
create mode 100644 gcc/testsuite/gfortran.dg/pr95584.f90
diff --git a/gcc/fortran/interface.c b/gcc/fortran/interface.c
index b1a75a37b0e..0cc504f4e04 100644
--- a/gcc/fortran/interface.c
+++ b/gcc/fortran/interface.c
@@ -1257,7 +1257,7 @@ generic_correspondence (gfc_formal_arglist *f1, gfc_formal_arglist *f2,
while (f1)
{
- if (f1->sym->attr.optional)
+ if (!f1->sym || f1->sym->attr.optional)
goto next;
if (p1 && strcmp (f1->sym->name, p1) == 0)
diff --git a/gcc/testsuite/gfortran.dg/pr95584.f90 b/gcc/testsuite/gfortran.dg/pr95584.f90
new file mode 100644
index 00000000000..4504f7b500c
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/pr95584.f90
@@ -0,0 +1,16 @@
+! { dg-do compile }
+
+program p
+ interface s
+ subroutine g(x, *)
+ end
+ subroutine h(y, *)
+ end
+ end interface
+end
+
+! { dg-warning "Obsolescent feature: Alternate-return argument" " " { target *-*-* } 5 }
+! { dg-warning "Obsolescent feature: Alternate-return argument" " " { target *-*-* } 7 }
+! { dg-error ".1." " " { target *-*-* } 5 }
+! { dg-error "Ambiguous interfaces in generic interface" " " { target *-*-* } 7 }
+
--
2.11.0
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] Fortran : ICE in generic_correspondence PR95584
2020-06-25 6:33 Fortran : ICE in generic_correspondence PR95584 Mark Eggleston
@ 2020-06-30 13:02 ` Mark Eggleston
2020-06-30 13:27 ` Thomas Koenig
1 sibling, 0 replies; 3+ messages in thread
From: Mark Eggleston @ 2020-06-30 13:02 UTC (permalink / raw)
To: gcc-patches, fortran
I forgot to use [PATCH] in the subject line. ping!
On 25/06/2020 07:33, Mark Eggleston wrote:
> Please find attached fix for PR95584. Original patch by Steve Kargl.
>
> OK to commit and backport?
>
> Commit message:
>
> Fortran : ICE in generic_correspondence PR95584
>
> Output an error for ambiguous interfaces in generic interface
> instead of ICE.
>
> 2020-06-25 Steven G. Kargl <kargl@gcc.gnu.org>
>
> gcc/fortran/
>
> PR fortran/95584
> * interface.c (generic_correspondence): Only use the pointer
> to a symbol if exists.
>
> 2020-06-25 Mark Eggleston <markeggleston@gcc.gnu.org>
>
> gcc/testsuite/
>
> PR fortran/95584
> * gfortran.dg/pr95584.f90: New test.
>
--
https://www.codethink.co.uk/privacy.html
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Fortran : ICE in generic_correspondence PR95584
2020-06-25 6:33 Fortran : ICE in generic_correspondence PR95584 Mark Eggleston
2020-06-30 13:02 ` [PATCH] " Mark Eggleston
@ 2020-06-30 13:27 ` Thomas Koenig
1 sibling, 0 replies; 3+ messages in thread
From: Thomas Koenig @ 2020-06-30 13:27 UTC (permalink / raw)
To: Mark Eggleston, gcc-patches, fortran
Hi Mark,
> OK to commit and backport?
OK, fixing such a NULL dererefence could also count as obvious
and simple (if it does the right thing :-)
Regarding backport: I probably would not do it myself; it's
not a regression, and ICE does not have such a large impact.
However, if you want to do it, feel free.
Thanks for taking this on!
Regards
Thomas
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2020-06-30 13:27 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-06-25 6:33 Fortran : ICE in generic_correspondence PR95584 Mark Eggleston
2020-06-30 13:02 ` [PATCH] " Mark Eggleston
2020-06-30 13:27 ` Thomas Koenig
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).