Skip to content

Too many continuation lines for Fortran 2008 #148

@jme52

Description

@jme52

The README states that

To build this project from the source code in this repository you need a Fortran compiler supporting at least the Fortran 2008 standard.

However, in Fortran 2008

A statement shall not have more than 255 continuation lines.

(see paragraph 2 of section 3.3.2.6 of Fortran 2008). Unfortunately the statement that defines vdwrad in src/dftd3/data/vdwrad.f90 and the statements used to define the values of c6ab_view in src/dftd3/reference.f90 have more than 255 continuation lines.

Some compilers don't check this, but others do. The limit, combined with the maximum length of a line (132 characters) imposes a maximum of ~34k characters in a statement up to Fortran 2018 (see paragraph 2 of section 6.3.2.6 of Fortran 2018; the limit was the same since Fortran 2003, and smaller before that).

The latest version of the standard addressed this: in Fortran 2003 (see section 6.3.2),

A line shall contain at most ten thousand characters. [...]
A statement shall not have more than one million characters.

I think it's a bit too early and disproportionate to indicate in the README that "a Fortran compiler supporting Fortran 2023 is needed", so I was wondering if it would be reasonable to address this at the source code level:

  • c6ab_view can be easily fixed by reducing the size of the chunks used to define the array, but I think that
  • vdwrad needs a bit of code refactoring so that it is initialised from a module subroutine.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions