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

--- Comment #11 from Damian Rouson <damian at archaeologic dot codes> ---
Now this is truly mind-blowing.  I'm using a patched version of gfortran that
Jerry built for me on a system we can both access.  When I put the code from
this PR's original submission in a file named "pr.f90", the code compiles
without error using "gfortran -c pr.f90", but then when I perform a simple
string search and replacement via

sed -i'' -e "s/hyperparameters/tensor_map/g" pr.f90 

the resulting code gives me an error matching the second of the two errors in
the original submission in this PR.  See below.  I even tried a couple of other
search-and-replacement options, e.g., using foo or foo_bar instead of
tensor_map, and those compiled without error.  Something about "tensor_map" is
causing a specific problem. :O

$ cat pr.f90 
module tensor_map_m
  implicit none

  type tensor_map_t(k)
    integer, kind :: k = kind(1.)
    real(k) :: learning_rate_ = real(1.5,k)
  contains
    generic :: operator(==) => default_real_equals
    procedure default_real_equals
  end type

  interface
    logical module function default_real_equals(lhs, rhs)
      implicit none
      class(tensor_map_t), intent(in) :: lhs, rhs
    end function
  end interface

end module

$ gfortran -c pr.f90 
pr.f90:8:30:

    8 |     generic :: operator(==) => default_real_equals
      |                              1
Error: Entity ‘default_real_equals’ at (1) is already present in the interface

$ gfortran --version
GNU Fortran (GCC) 16.0.0 20251022 (experimental)

Reply via email to