This is the mail archive of the fortran@gcc.gnu.org mailing list for the GNU Fortran project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: gfortran 4.6 crashes with a type-bound procedure that overloads .LT.


> 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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]