Skip to content

[flang] Unnecessary diagnostic on zero-length character object #163242

@DanielCChen

Description

@DanielCChen

Consider the following code:

character(0), allocatable :: ch
allocate(character(-1) :: ch)
end

Flang diagnoses this case with

error: Semantic errors in t.f
./t.f:2:27: error: Character length of allocatable object in ALLOCATE must be the same as the type-spec
  allocate(character(-1) :: ch)
                            ^^

Because both of the type-spec at the declaration and the allocate statement specify zero-length, the diagnostic message seems unnecessary.
All, gfortran, ifort and XLF don't diagnose this case.

Metadata

Metadata

Assignees

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions