Compiling and running the code below with gfortran 4.1 or mainline
produces the output
 foo1
 foo2
 foo2
instead of the correct output
 foo1
 foo1
 foo2

This occurs with 4.1 (release), 4.1.1 and mainline.
4.0.3 (prerelease) produces the correct output.


module mod1
  implicit none

  interface foo
     module procedure foo1, foo2
  end interface

contains

  subroutine foo1(bar)
    real bar
    print *,"foo1"
   end subroutine

  subroutine foo2(bar)
    real bar(3)
    print *,"foo2"
  end subroutine

end module mod1

program blah
  use mod1
  implicit none

  real bar(3)

  call foo (1e0)
  call foo (bar(1))
  call foo (bar)
end program


-- 
           Summary: [4.1,4.2 regression] gfortran: incorrect choice of
                    overloaded function
           Product: gcc
           Version: 4.1.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: martin at mpa-garching dot mpg dot de
 GCC build triplet: i686-pc-linux-gnu
  GCC host triplet: i686-pc-linux-gnu
GCC target triplet: i686-pc-linux-gnu


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=26716

Reply via email to