[Bug fortran/63797] Bogus ambiguous reference to 'sqrt'
anlauf at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Tue Apr 13 20:49:35 GMT 2021
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
More information about the Gcc-bugs
mailing list