public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "anlauf at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug fortran/108544] ICE in check_host_association, at fortran/resolve.cc:6135
Date: Wed, 25 Jan 2023 21:41:20 +0000	[thread overview]
Message-ID: <bug-108544-4-f2kIwoN1Kw@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-108544-4@http.gcc.gnu.org/bugzilla/>

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108544

--- Comment #2 from anlauf at gcc dot gnu.org ---
I played a little and found a variation of testcase pr96102.f90
that was silently accepted but is rejected by Intel, NAG, Cray, NVidia:

module m
  type mytype
    integer :: i
  end type
  type(mytype) :: d = mytype (42) ! { dg-error "is host associated" }
  integer      :: n = 2           ! { dg-error "is host associated" }
contains
  subroutine s
    if ( n   /= 0 ) stop 1  ! { dg-error "internal procedure of the same name"
}
    if ( d%i /= 0 ) stop 2  ! { dg-error "internal procedure of the same name"
}
  contains
    subroutine n()
    end
    subroutine d()
    end
  end
end

This need removing just one line of code in addition to comment#1:

diff --git a/gcc/fortran/resolve.cc b/gcc/fortran/resolve.cc
index 94213cd3cd4..b40e04513b5 100644
--- a/gcc/fortran/resolve.cc
+++ b/gcc/fortran/resolve.cc
@@ -6087,7 +6093,6 @@ check_host_association (gfc_expr *e)
       gfc_find_symbol (e->symtree->name, gfc_current_ns, 1, &sym);

       if (sym && old_sym != sym
-             && sym->ts.type == old_sym->ts.type
              && sym->attr.flavor == FL_PROCEDURE
              && sym->attr.contained)
        {
@@ -6132,6 +6137,9 @@ check_host_association (gfc_expr *e)
                  return false;
                }

+             if (ref == NULL)
+               return false;
+
              gcc_assert (ref->type == REF_ARRAY);

              /* Grab the start expressions from the array ref and

Am I missing something?

  parent reply	other threads:[~2023-01-25 21:41 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-01-25 17:49 [Bug fortran/108544] New: " gscfq@t-online.de
2023-01-25 20:14 ` [Bug fortran/108544] " anlauf at gcc dot gnu.org
2023-01-25 21:41 ` anlauf at gcc dot gnu.org [this message]
2023-01-25 22:00 ` anlauf at gcc dot gnu.org
2023-01-26 18:35 ` cvs-commit at gcc dot gnu.org
2023-01-26 19:11 ` anlauf at gcc dot gnu.org

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-108544-4-f2kIwoN1Kw@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).