This is the mail archive of the
fortran@gcc.gnu.org
mailing list for the GNU Fortran project.
Re: gfortran 4.6 crashes with a type-bound procedure that overloads .LT.
- From: Janus Weil <janus at gcc dot gnu dot org>
- To: Mark Rashid <mmrashid at ucdavis dot edu>
- Cc: fortran <fortran at gcc dot gnu dot org>
- Date: Thu, 7 Oct 2010 10:52:32 +0200
- Subject: Re: gfortran 4.6 crashes with a type-bound procedure that overloads .LT.
- References: <1286401597.22978.97.camel@skyliner>
> I have run into erratic behavior trying to compile a module that defines
> a derived type with a component that is, in turn, another derived type
> that has a type-bound relational operator (.LT.). ?Depending on the
> specifics, I sometimes get a compiler crash and sometimes successful
> completion, but wrong code. ?Near-minimal code that produces a crash is
> copied below.
>
> Module DEF1 compiles OK. ?But subsequently trying to compile module MESH
> produces:
>
> f951: ?internal compiler error: in gfc_add_component_ref, at
> fortran/class.c:77
>
> The problem seems to be the line
>
> LST = (A%PT .LT. B%PT)
>
> in module MESH, which invokes the overloaded .LT. defined in module
> DEF1.
Further observation: The problem is not related to overloading. The
following reduced/modified test case fails with the same error
message:
MODULE DEF1
TYPE :: DAT
INTEGER :: NN
CONTAINS
PROCEDURE :: LESS_THAN
GENERIC :: OPERATOR (.LT.) => LESS_THAN
END TYPE
CONTAINS
LOGICAL FUNCTION LESS_THAN(A, B)
CLASS (DAT), INTENT (IN) :: A, B
LESS_THAN = (A%NN .LT. B%NN)
END FUNCTION
END MODULE
PROGRAM P
USE DEF1
TYPE NODE
TYPE (DAT), POINTER :: PT
END TYPE
CLASS (NODE),POINTER :: A, B
PRINT *, A%PT .LT. B%PT
END
Cheers,
Janus