In the testcase below, compiled with:

    gfortran -c test.f90

gfortran suffers an internal compiler error:

internal compiler error: in gfc_gen_symbol_decl, at fortran/trans-decl.c:893

If the commenting on the marked line is removed, then the code compiles fine.

I have tested this case with versions 4.3.2, 4.4.1 and 4.6 (experimental, from
svn trunk last night). It works correctly using ifort, PGI and pathscale
compilers.

---------------------------------------

module test_mod

    implicit none

contains

    subroutine test_fn (cmp)

        interface operator(.myop.)
            pure function cmp (a, b) result(ret)
                integer, intent(in) :: a, b
                logical ret
            end function
        end interface

        integer :: a, b

        !print*, cmp(a, b)   ! If this line is commented out, gfortran has an
                            ! internal compiler error
        print*, a .myop. b

    end subroutine

end module


-- 
           Summary: Failure on interfacing a function passed as an argument
                    as a custom operator
           Product: gcc
           Version: 4.6.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: sds50 at cam dot ac dot uk


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

Reply via email to