Skip to content

Disallow unimplemented feature ((re)allocation under WHERE)Β #349

@klausler

Description

@klausler

Fortran 2003 supports (re)allocation of a whole allocatable variable or component as part of intrinsic assignment, including the case of assignment to a polymorphic allocatable with a right-hand side expression with a distinct dynamic type. There is no restriction preventing this feature from being used when the intrinsic assignment appears in a WHERE statement or construct. Although this usage would risk leaving masked-out elements undefined, the semantics do seem straightforward.

As running https://github.com/klausler/fortran-wringer-tests/blob/main/poly-where.f90 through various available compilers shows, no implementation changes the type of a polymorphic whole allocatable variable or component when the intrinsic assignment statement is controlled by WHERE.

In the absence of implementations, after 23 years it would be safe to add language to the standard that excludes where-assignment-stmts from the intrinsic assignments that (re)allocate a whole allocatable left-hand side. This would reduce confusion among users and implementors.

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