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
*** Bug 45339 has been marked as a duplicate of this bug. ***
Created attachment 22868 [details] Tentative patch Sounds like the referenced attribute isn't set correctly. We could try setting it during resolution, like this.
Author: tkoenig Date: Fri Dec 31 11:20:22 2010 New Revision: 168366 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=168366 Log: 2010-12-31 Thomas Koenig <tkoenig@gcc.gnu.org> PR fortran/45338 * resolve.c (resolve_operator): Mark function for user-defined operator as referenced. 2010-12-31 Thomas Koenig <tkoenig@gcc.gnu.org> PR fortran/45338 * gfortran.dg/userdef_operator_2.f90: New test case. Added: trunk/gcc/testsuite/gfortran.dg/userdef_operator_2.f90 Modified: trunk/gcc/fortran/ChangeLog trunk/gcc/fortran/resolve.c trunk/gcc/testsuite/ChangeLog
Fixed on trunk, backport to 4.5 pending.
Author: tkoenig Date: Sun Jan 2 21:58:03 2011 New Revision: 168410 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=168410 Log: 2011-02-01 Thomas Koenig <tkoenig@gcc.gnu.org> Backport from mainline PR fortran/45338 * resolve.c (resolve_operator): Mark function for user-defined operator as referenced. 2011-02-01 Thomas Koenig <tkoenig@gcc.gnu.org> Backport from mainline PR fortran/45338 * gfortran.dg/userdef_operator_2.f90: New test case. Added: branches/gcc-4_5-branch/gcc/testsuite/gfortran.dg/userdef_operator_2.f90 Modified: branches/gcc-4_5-branch/gcc/fortran/ChangeLog branches/gcc-4_5-branch/gcc/fortran/resolve.c branches/gcc-4_5-branch/gcc/testsuite/ChangeLog
Fixed on trunk and 4.5. Closing.