ICE due to an elemental function returning a derived type

Paul Thomas paulthomas2@wanadoo.fr
Sun Aug 6 21:17:00 GMT 2006


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
>
>
>



More information about the Fortran mailing list