Skip to content

[flang] Incorrect result of ASSOCIATED when the pointer is associated with zero sized storage sequence #155481

@DanielCChen

Description

@DanielCChen

Consider the following code:

    type base
    end type

    type, extends (base) :: child
        integer(8) :: something
    end type

    class (*), pointer :: x, x1(:)

    type (child), target :: c1, c2(10)

    x => c1%base
    x1 => c2%base

    print*, associated (x, c1%base)
    print*, associated (x1, c2%base)
end

Flang outputs T T, but the expected output should be F F as the standard requires none zero sized storage sequence for intrinsic ASSOCIATED to return true.

Case (v): If TARGET is present and is a scalar target, the result is true if and only if TARGET is not a zero-sized storage sequence and POINTER is associated with a target that occupies the same storage units as TARGET.

Case (vi): If TARGET is present and is an array target, the result is true if and only if POINTER is associated with a target that has the same shape as TARGET, is neither of size zero nor an arraywhose elements are zero-sized storage sequences, and occupies the same storage units as TARGET in array element order.

Metadata

Metadata

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions