Skip to content

[Flang] Compilation error when arrays specified in the COMMON block are declared with EQUIVALENCE #65922

@ohno-fj

Description

@ohno-fj
Version of flang-new : 18.0.0(c07062a2e9bf9aa1211b958f6bb4c5746139c180) 

Declaring arrays specified in a COMMON block with EQUIVALENCE results in a compilation error.

The following are the test program, Flang-new, Gfortran and ifort compilation result.

cvct6211.cmp_2.f90:

PROGRAM MAIN INTEGER(KIND=4)::RV01(-9:10) INTEGER(KIND=4)::LV01(10) COMMON // RV01, LV01 CALL INIT() END PROGRAM MAIN SUBROUTINE INIT() COMMON // RV01, LV01 EQUIVALENCE (RV01(1), LV02), (LV02(11), LV01) INTEGER(KIND=4) LV01(10), LV02(11) INTEGER(KIND=4) RV01(-9:10) RETURN END SUBROUTINE INIT
$ flang-new cvct6211.cmp_2.f90 error: Semantic errors in cvct6211.cmp_2.f90 ./cvct6211.cmp_2.f90:11:19: error: 'lv01' is storage associated with 'rv01' by EQUIVALENCE elsewhere in COMMON block // INTEGER(KIND=4) LV01(10), LV02(11) ^^^^ $ 
$ gfortran cvct6211.cmp_2.f90 $ 
$ ifort cvct6211.cmp_2.f90 $ 

Metadata

Metadata

Assignees

Labels

bugIndicates an unexpected problem or unintended behaviorflang:frontend

Type

No type

Projects

Status

Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions