[F03] EXTENDS_TYPE_OF, CLASS IS and libgfortran

View: New views
5 Messages — Rating Filter:   Alert me  

[F03] EXTENDS_TYPE_OF, CLASS IS and libgfortran

by Paul Richard Thomas :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Janus,

This is OK for trunk, since it does not affect the F95 side of things.

Thanks for the patch and please do not forget to add it to fortran-dev.

Paul

2009-11-04  Janus Weil  <janus@...>

        * intrinsic.h (gfc_resolve_extends_type_of): Add prototype
        * intrinsic.c (add_functions): Use 'gfc_resolve_extends_type_of'.
        * iresolve.c (gfc_resolve_extends_type_of): New function, which replaces
        the call to EXTENDS_TYPE_OF by the library function 'is_extension_of'
        and modifies the arguments.
        * trans-intrinsic.c (gfc_conv_extends_type_of): Removed.
        (gfc_conv_intrinsic_function): FOR EXTENDS_TYPE_OF, don't call
        gfc_conv_extends_type_of but gfc_conv_intrinsic_funcall.


2009-11-04  Janus Weil  <janusw@...>

        * gfortran.map: Add _gfortran_is_extension_of.
        * Makefile.am: Add intrinsics/extends_type_of.c.
        * Makefile.in: Regenerated.
        * intrinsics/extends_type_of.c: New file.


2009-11-04  Janus Weil  <janusw@...>

        * gfortran.dg/extends_type_of_1.f03: New test.
        * gfortran.dg/same_type_as_1.f03: Extended.

Re: [F03] EXTENDS_TYPE_OF, CLASS IS and libgfortran

by Janus Weil-3 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi Paul,

> This is OK for trunk, since it does not affect the F95 side of things.

trunk? The patch will surely not apply to trunk, since it relies on
the $extends field and the vtable stuff, which only exists on the
branch!

> Thanks for the patch and please do not forget to add it to fortran-dev.

This I can surely do ;)

Cheers,
Janus


> 2009-11-04  Janus Weil  <janus@...>
>
>        * intrinsic.h (gfc_resolve_extends_type_of): Add prototype
>        * intrinsic.c (add_functions): Use 'gfc_resolve_extends_type_of'.
>        * iresolve.c (gfc_resolve_extends_type_of): New function, which replaces
>        the call to EXTENDS_TYPE_OF by the library function 'is_extension_of'
>        and modifies the arguments.
>        * trans-intrinsic.c (gfc_conv_extends_type_of): Removed.
>        (gfc_conv_intrinsic_function): FOR EXTENDS_TYPE_OF, don't call
>        gfc_conv_extends_type_of but gfc_conv_intrinsic_funcall.
>
>
> 2009-11-04  Janus Weil  <janusw@...>
>
>        * gfortran.map: Add _gfortran_is_extension_of.
>        * Makefile.am: Add intrinsics/extends_type_of.c.
>        * Makefile.in: Regenerated.
>        * intrinsics/extends_type_of.c: New file.
>
>
> 2009-11-04  Janus Weil  <janusw@...>
>
>        * gfortran.dg/extends_type_of_1.f03: New test.
>        * gfortran.dg/same_type_as_1.f03: Extended.
>

Re: [F03] EXTENDS_TYPE_OF, CLASS IS and libgfortran

by Janus Weil-3 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

>> Thanks for the patch and please do not forget to add it to fortran-dev.
>
> This I can surely do ;)

Committed as r153994. Thanks for the review.

Btw, I'm not aware of any compiler besides gfortran (fortran-dev
branch), which is able to handle the new test case
extends_type_of_1.f03 ...

ifort 11.1 gives:

: catastrophic error: **Internal compiler error: segmentation
violation signal raised** Please report this error along with the
circumstances in which it occurred in a Software Problem Report.
Note: File and line given may not be explicit cause of this error.

and nagfor 5.2:

Warning: extends_type_of_1.f03, line 49: Type declaration for generic
intrinsic EXTENDS_TYPE_OF ignored
         detected at END@<end-of-statement>
Panic: extends_type_of_1.f03, line 33: Generic intrinsic
EXTENDS_TYPE_OF does not exist
Internal Error -- please report this bug

:)

Cheers,
Janus



>> 2009-11-04  Janus Weil  <janus@...>
>>
>>        * intrinsic.h (gfc_resolve_extends_type_of): Add prototype
>>        * intrinsic.c (add_functions): Use 'gfc_resolve_extends_type_of'.
>>        * iresolve.c (gfc_resolve_extends_type_of): New function, which replaces
>>        the call to EXTENDS_TYPE_OF by the library function 'is_extension_of'
>>        and modifies the arguments.
>>        * trans-intrinsic.c (gfc_conv_extends_type_of): Removed.
>>        (gfc_conv_intrinsic_function): FOR EXTENDS_TYPE_OF, don't call
>>        gfc_conv_extends_type_of but gfc_conv_intrinsic_funcall.
>>
>>
>> 2009-11-04  Janus Weil  <janusw@...>
>>
>>        * gfortran.map: Add _gfortran_is_extension_of.
>>        * Makefile.am: Add intrinsics/extends_type_of.c.
>>        * Makefile.in: Regenerated.
>>        * intrinsics/extends_type_of.c: New file.
>>
>>
>> 2009-11-04  Janus Weil  <janusw@...>
>>
>>        * gfortran.dg/extends_type_of_1.f03: New test.
>>        * gfortran.dg/same_type_as_1.f03: Extended.
>>
>

Parent Message unknown Re: [F03] EXTENDS_TYPE_OF, CLASS IS and libgfortran

by FX Coudert :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi Janus,

> Btw, I'm not aware of any compiler besides gfortran (fortran-dev
> branch), which is able to handle the new test case
> extends_type_of_1.f03 ...

First, congrats to all on all the OO goodness that is creeping into  
gfortran. I check on this list from time to time, and you seem to be  
making very good progress.

I'm all the more sorry to send an email just to contradict you. The  
IBM compiler handles this testcase just fine, but even more, it  
actually finds an error in it:

> "a.f03", line 10.13: 1514-068 (E) Explicit type does not agree with  
> type of INTRINSIC function.  Type specification is ignored.

(though the test then runs fine). After looking at my F2008 draft, I  
think I concur with it: EXTENDS_TYPE_OF should return a default  
logical scalar, not an integer.


Regards,
FX

Re: [F03] EXTENDS_TYPE_OF, CLASS IS and libgfortran

by Janus Weil-3 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi FX,

>> Btw, I'm not aware of any compiler besides gfortran (fortran-dev
>> branch), which is able to handle the new test case
>> extends_type_of_1.f03 ...
>
> First, congrats to all on all the OO goodness that is creeping into
> gfortran. I check on this list from time to time, and you seem to be making
> very good progress.
>
> I'm all the more sorry to send an email just to contradict you. The IBM
> compiler handles this testcase just fine

sure, that was to be expected. After all I didn't claim that there
*is* no compiler which can handle the test case, just that I'm not
*aware* of any (in that sense it's no contradiction). I checked all
compilers I have access to, which just doesn't include the IBM
compiler.


> but even more, it actually finds an error in it:
>
>> "a.f03", line 10.13: 1514-068 (E) Explicit type does not agree with type
>> of INTRINSIC function.  Type specification is ignored.
>
> (though the test then runs fine). After looking at my F2008 draft, I think I
> concur with it: EXTENDS_TYPE_OF should return a default logical scalar, not
> an integer.

Uh, sorry about that (don't know how the 'integer' crept in, of course
it should be 'logcial'). I will correct this, and add a check to
prevent this kind of mis-declaration.

Thanks for your comments ...

Cheers,
Janus