gfortran: OOP features [Fortran 2003/2008]

OOP here refers to "Object-Oriented Programming", which was introduced to Fortran in the 2003 standard. The purpose of this page is to document which features have been implemented in gfortran so far, what is still missing and which problems can be expected.


Implemented features

The following features are available in gfortran 4.5:

These additional features are available in 4.6:

These additional features are available in 4.7:

These additional features are available in 4.8:

These additional features are available in 4.9:

These additional features are available in version 7:

Unimplemented features

Internal Representation

The current implementation is such that each class(t) variable consists of a class container (named __class_X) with two fields (PR53971):

For each derived type t we then construct a vtab entity (called __vtab_X), which is of a type __vtype_X and contains the following fields:

In the naming of class containers, vtabs and vtypes, the X is usually being replaced by a combination of module name and type name. However, if the resulting string is too long, we insert a hashed string instead, which is a hex representation of the type's _hash value.

Object-oriented Fortran codes

Here are some examples of codes that make use of object-oriented features from Fortran 2003 (certain not the most comprehensive list, though) ...


Open Problems

[Here is a list of all OOP-related bugs.]

PRs related to CLASS arrays (10):

Also the implementation of SELECT TYPE still has a few bugs (6):

Bugs concerning type-bound generics & operators (6):

Miscellaneous (compile-time) bugs (8):

Accepts-invalid, ICE-on-invalid and diagnostic bugs (5):

Runtime problems (wrong code, missed optimization) (9):

Extended features of Fortran 2008 (4):

Fixed Bugs

Fixed in 4.5.x (36)

Fixed in 4.6.x (103)

Fixed in 4.7.x (58)

Fixed in 4.8.x (49)

Fixed in 4.9.x (46)

Fixed in 5.x (17)

Fixed in 6.x (7)

Fixed in 7.x (23)

Fixed in 8.x (1)

None: OOP (last edited 2017-05-17 16:24:45 by JanusWeil)