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: ICE due to an elemental function returning a derived type


Mark

This looks almost identical to a problem that was fixed a year ago. At the moment, I cannot see what the difference is; however, for some reason foo.mod has two definitions of ieee_class_type and these are treated as being different in the assignment class=bar(x). A temporary workaround is indicated below.

Please submit a bug report. I will attend to it this week.

Paul



MODULE types
   TYPE, PUBLIC   :: ieee_class_type
      INTEGER     :: ieee_particular_features
   END TYPE
END MODULE types

MODULE foo
   USE types
   PUBLIC                                    :: ieee_class_type
   TYPE(ieee_class_type), PARAMETER, PUBLIC  :: &
      IEEE_SIGNALING_NAN=ieee_class_type(0)
CONTAINS
   ELEMENTAL FUNCTION bar (x) RESULT(class)
      USE types


Eliminating this USE statement gets rid of the problem; ie host associating the type gets rid of the duplication.

      REAL, INTENT(IN)        :: x
      TYPE(ieee_class_type)   :: class
      class=IEEE_SIGNALING_NAN
   END FUNCTION bar
END MODULE

LOGICAL ELEMENTAL FUNCTION foobar (x)
   USE foo
   REAL, INTENT(IN)        :: x
   TYPE(ieee_class_type)   :: class

   foobar=.FALSE.
   class=bar (x)

END FUNCTION foobar





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