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/63797] Bogus ambiguous reference to 'sqrt'
Date: Tue, 13 Apr 2021 20:49:35 +0000	[thread overview]
Message-ID: <bug-63797-4-5eLPjeiHWo@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-63797-4@http.gcc.gnu.org/bugzilla/>

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

--- Comment #4 from anlauf at gcc dot gnu.org ---
The following patch regtests ok and fixes the testcase:

diff --git a/gcc/fortran/module.c b/gcc/fortran/module.c
index 4db0a3ac76d..b4b7b437f86 100644
--- a/gcc/fortran/module.c
+++ b/gcc/fortran/module.c
@@ -6218,6 +6218,9 @@ write_symtree (gfc_symtree *st)
   if (check_unique_name (st->name))
     return;

+  if (strcmp (sym->module, "(intrinsic)") == 0)
+    return;
+
   p = find_pointer (sym);
   if (p == NULL)
     gfc_internal_error ("write_symtree(): Symbol not written");


It even fixes the slightly reduced & refined testcase:

module mod1
  implicit none
  real, parameter :: z = sqrt (0.0)
end module mod1

module mod2
  implicit none
  type t
     real :: a = 0.
  end type
  interface sqrt
     module procedure sqrt
  end interface
contains
  function sqrt (a)
    type(t), intent(in) :: a
    type(t)             :: sqrt
    sqrt% a = a% a
  end function sqrt
end module mod2

program test
  use mod1
  use mod2
  implicit none
  type(t) :: x, y
  y = sqrt (x)
end program test

  parent reply	other threads:[~2021-04-13 20:49 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-11-09 17:13 [Bug fortran/63797] New: " burnus at gcc dot gnu.org
2014-11-09 17:15 ` [Bug fortran/63797] " burnus at gcc dot gnu.org
2021-04-10  0:29 ` chrisonian at gmail dot com
2021-04-12 21:48 ` kargl at gcc dot gnu.org
2021-04-13 20:06 ` anlauf at gcc dot gnu.org
2021-04-13 20:49 ` anlauf at gcc dot gnu.org [this message]
2021-04-14  1:25 ` sgk at troutmask dot apl.washington.edu
2021-04-14 20:43 ` anlauf at gcc dot gnu.org
2021-04-14 21:37 ` sgk at troutmask dot apl.washington.edu
2021-04-15 20:40 ` anlauf at gcc dot gnu.org
2021-04-15 20:52 ` anlauf at gcc dot gnu.org
2021-04-16 14:24 ` cvs-commit at gcc dot gnu.org
2021-04-18 19:48 ` cvs-commit at gcc dot gnu.org
2021-04-18 19:50 ` 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-63797-4-5eLPjeiHWo@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).