diff mbox series

[fortran] PR96102 - ICE in check_host_association, at fortran/resolve.c:5994

Message ID CAGkQGiJWB5vDk7PYoO_uh6Ys_YLT8Xvh0LwB=Aozcg5qUyVG=g@mail.gmail.com
State New
Headers show
Series [fortran] PR96102 - ICE in check_host_association, at fortran/resolve.c:5994 | expand

Commit Message

Paul Richard Thomas Aug. 5, 2020, 2:59 p.m. UTC
The attached patch builds on a draft posted by Steve Kargl. I have left the
gcc_assert in place just in case my imagination was too limited to generate
an ICE.

Regtests OK on FC31/x86_64 - OK for trunk?

Paul

Comments

Steve Kargl Aug. 5, 2020, 3:40 p.m. UTC | #1
On Wed, Aug 05, 2020 at 03:59:38PM +0100, Paul Richard Thomas wrote:
> The attached patch builds on a draft posted by Steve Kargl. I have left the
> gcc_assert in place just in case my imagination was too limited to generate
> an ICE.
> 
> Regtests OK on FC31/x86_64 - OK for trunk?
> 

Looks OK to me.
Paul Richard Thomas Aug. 6, 2020, 5:21 a.m. UTC | #2
Dear All,

Dominique has kindly pointed out that the error message in the patch does
not correspond to the errors in the testcase. This came about because the
submitted patch was an earlier version of that on my tree. Please find
attached the correct version of the patch. The principle is the same but
the error is different... if you see what I mean :-)

Paul

On Wed, 5 Aug 2020 at 16:40, Steve Kargl <sgk@troutmask.apl.washington.edu>
wrote:

> On Wed, Aug 05, 2020 at 03:59:38PM +0100, Paul Richard Thomas wrote:
> > The attached patch builds on a draft posted by Steve Kargl. I have left
> the
> > gcc_assert in place just in case my imagination was too limited to
> generate
> > an ICE.
> >
> > Regtests OK on FC31/x86_64 - OK for trunk?
> >
>
> Looks OK to me.
>
> --
> Steve
>
Thomas Koenig Aug. 9, 2020, 9:58 a.m. UTC | #3
Hi Paul,

> Dominique has kindly pointed out that the error message in the patch does
> not correspond to the errors in the testcase. This came about because the
> submitted patch was an earlier version of that on my tree. Please find
> attached the correct version of the patch. The principle is the same but
> the error is different... if you see what I mean :-)

OK for master.

Best regards

	Thomas
diff mbox series

Patch

diff --git a/gcc/fortran/resolve.c b/gcc/fortran/resolve.c
index 2751c0ccf62..4046bed1863 100644
--- a/gcc/fortran/resolve.c
+++ b/gcc/fortran/resolve.c
@@ -5993,6 +5993,17 @@  check_host_association (gfc_expr *e)
 		if (ref->type == REF_ARRAY && ref->next == NULL)
 		  break;
 
+	      if ((ref == NULL || ref->type != REF_ARRAY)
+		  && old_sym->attr.flavor == FL_VARIABLE
+		  && sym->attr.proc == PROC_INTERNAL)
+		{
+		  gfc_error ("%qs at %L is being host associated into "
+			     "a contained procedure with an internal "
+			     "procedure of the same name", sym->name,
+			      &sym->declared_at);
+		  return false;
+		}
+
 	      gcc_assert (ref->type == REF_ARRAY);
 
 	      /* Grab the start expressions from the array ref and