xref: /llvm-project/flang/test/Semantics/canondo12.f90 (revision 31ad5c14fefa66085eff3629c0cc8393556ba849)
1ae742523SRichard Barton! Error test -- DO loop uses obsolete loop termination statement (warning)
264ab3302SCarolineConcatto! See R1131 and C1133
364ab3302SCarolineConcatto
464ab3302SCarolineConcatto! By default, this is not an error and label do are rewritten to non-label do.
5*31ad5c14SArnamoy Bhattacharyya! A warning is generated with -pedantic
664ab3302SCarolineConcatto
7*31ad5c14SArnamoy Bhattacharyya! RUN: %flang_fc1 -fdebug-unparse-with-symbols -pedantic %s 2>%t.stderr | FileCheck %s
864ab3302SCarolineConcatto
964ab3302SCarolineConcatto! CHECK: end do
1064ab3302SCarolineConcatto
1164ab3302SCarolineConcatto! The following CHECK-NOT actively uses the fact that the leading zero of labels
1264ab3302SCarolineConcatto! would be removed in the unparse but not the line linked to warnings. We do
1364ab3302SCarolineConcatto! not want to see label do in the unparse only.
1464ab3302SCarolineConcatto! CHECK-NOT: do [1-9]
1564ab3302SCarolineConcatto
16ae742523SRichard Barton! RUN: FileCheck --check-prefix=ERR --input-file=%t.stderr %s
17ae742523SRichard Barton! ERR: A DO loop should terminate with an END DO or CONTINUE
1864ab3302SCarolineConcatto
1964ab3302SCarolineConcattosubroutine foo4()
2064ab3302SCarolineConcatto  real :: a(10, 10), b(10, 10) = 1.0
2164ab3302SCarolineConcatto  do 01 k=1,4
2264ab3302SCarolineConcatto    block
2364ab3302SCarolineConcatto      real b
2464ab3302SCarolineConcatto      b = a(k, k)
2564ab3302SCarolineConcatto      a(k, k) = k*b
2664ab3302SCarolineConcatto01  end block
2764ab3302SCarolineConcattoend subroutine
28