xref: /llvm-project/flang/test/Semantics/canondo11.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
764ab3302SCarolineConcatto
8*31ad5c14SArnamoy Bhattacharyya! RUN: %flang_fc1 -fdebug-unparse-with-symbols -pedantic %s 2>%t.stderr | FileCheck %s
964ab3302SCarolineConcatto
1064ab3302SCarolineConcatto! CHECK: end do
1164ab3302SCarolineConcatto
1264ab3302SCarolineConcatto! The following CHECK-NOT actively uses the fact that the leading zero of labels
1364ab3302SCarolineConcatto! would be removed in the unparse but not the line linked to warnings. We do
1464ab3302SCarolineConcatto! not want to see label do in the unparse only.
1564ab3302SCarolineConcatto! CHECK-NOT: do [1-9]
1664ab3302SCarolineConcatto
17ae742523SRichard Barton! RUN: FileCheck --check-prefix=ERR --input-file=%t.stderr %s
18ae742523SRichard Barton! ERR: A DO loop should terminate with an END DO or CONTINUE
1964ab3302SCarolineConcatto
2064ab3302SCarolineConcattosubroutine foo3()
2164ab3302SCarolineConcatto  real :: a(10, 10), b(10, 10) = 1.0
2264ab3302SCarolineConcatto  do 01 k=1,4
2364ab3302SCarolineConcatto    associate (x=>a(k+1, 2*k), y=>b(k, 2*k-1))
2464ab3302SCarolineConcatto      x = 4*x*x + x*y -2*y
2564ab3302SCarolineConcatto01  end associate
2664ab3302SCarolineConcattoend subroutine
27