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: Wed, 14 Apr 2021 20:43:50 +0000	[thread overview]
Message-ID: <bug-63797-4-sIddd4Fjvk@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 #6 from anlauf at gcc dot gnu.org ---
Steve, can you give an example for the procedure pointer case you mentioned?
I played a bit, but the only valid code that I can think of did not produce
a reference to sqrt in such a way that it needs to show up in the mod.

Extended testcase that compiles and also uses a procedure pointer to sqrt():

! { dg-do compile }
! PR63797 - Bogus ambiguous reference to 'sqrt'

module mod1
  implicit none
  real, parameter :: z = sqrt (0.0)
  real            :: w = sqrt (1.0)
  interface
     pure real function sqrt_ifc (x)
       real, intent(in) :: x
     end function sqrt_ifc
  end interface
contains
  pure function myroot () result (f)
    procedure(sqrt_ifc), pointer :: f
    intrinsic :: sqrt
    f => sqrt
  end function myroot
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
  procedure(sqrt_ifc), pointer :: root
  root => myroot ()
  y    = sqrt (x)
  y% a = sqrt (x% a) + z - w + root (x% a)
end program test

  parent reply	other threads:[~2021-04-14 20:43 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
2021-04-14  1:25 ` sgk at troutmask dot apl.washington.edu
2021-04-14 20:43 ` anlauf at gcc dot gnu.org [this message]
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-sIddd4Fjvk@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).