Skip to content

[Flang] Compilation error of CYCLE statement in DO construct with a label #67283

@ohno-fj

Description

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

CYCLE statement in DO construct with a label results in a compilation error.
If no label (10, 20, and 30) is specified, compilation terminates normally.

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

snfsm133_51.f90:

program main
  integer ans1,ans2,ans3,ans4,a,b,c,j
  data ans1,ans2,ans3,ans4/0,0,0,0/
  bbb:do 20 c=1,1
     aaa:do 10 b=1,2
        vvv:do 30 j=1,1
           if (b.eq.1) goto 14
           do a=1,2
              ans1=ans1+1
              cycle
              ans2=ans2+1
           enddo
14         cycle aaa
30      enddo vvv
        ans3=ans3+1
10   enddo aaa
     ans4=ans4+1
20 enddo bbb
  write(6,*) "ans1=",ans1," ans=2",ans2," ans=3",ans3," ans=4",ans4
end program main
$ flang-new snfsm133_51.f90
error: Semantic errors in snfsm133_51.f90
./snfsm133_51.f90:13:18: error: CYCLE construct-name is not in scope
  14         cycle aaa
                   ^^^
$
$ gfortran snfsm133_51.f90
$
$ ifort snfsm133_51.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