diff options
Diffstat (limited to 'test')
-rw-r--r-- | test/Parser/do.f95 | 3 | ||||
-rw-r--r-- | test/Parser/if.f95 | 4 | ||||
-rw-r--r-- | test/Sema/beginEndRecovery.f95 | 36 | ||||
-rw-r--r-- | test/Sema/do.f95 | 13 | ||||
-rw-r--r-- | test/Sema/dowhile.f95 | 6 | ||||
-rw-r--r-- | test/Sema/if.f95 | 12 | ||||
-rw-r--r-- | test/Sema/subprogram.f95 | 5 |
7 files changed, 55 insertions, 24 deletions
diff --git a/test/Parser/do.f95 b/test/Parser/do.f95 index 2f3d69a94a..d732f491a7 100644 --- a/test/Parser/do.f95 +++ b/test/Parser/do.f95 @@ -50,7 +50,6 @@ PROGRAM dotest ENDDO DO x I = 1,2 ! expected-error {{expected '='}} - ! END DO + END DO - DO I = 1,5 ! expected-error@+1 {{expected 'END DO'}} END PROGRAM diff --git a/test/Parser/if.f95 b/test/Parser/if.f95 index 2c3397bc13..7657c53155 100644 --- a/test/Parser/if.f95 +++ b/test/Parser/if.f95 @@ -56,6 +56,6 @@ PROGRAM iftest ENDIF END IF - IF(1 == 2) THEN - C = "NO" ! expected-error@+1 {{expected 'END IF'}} + IF(1 == 2) THEN ! expected-note {{to match this 'if'}} + C = "NO" ! expected-error@+1 {{expected 'end if'}} END PROGRAM iftest diff --git a/test/Sema/beginEndRecovery.f95 b/test/Sema/beginEndRecovery.f95 new file mode 100644 index 0000000000..4defe9b5db --- /dev/null +++ b/test/Sema/beginEndRecovery.f95 @@ -0,0 +1,36 @@ +! RUN: %flang -fsyntax-only -verify < %s + +program recovery + + do i = 1, 10 + if (i == 0) then ! expected-note {{to match this 'if'}} + end do ! expected-error {{expected 'end if'}} + + do while(.true.) ! expected-error@+3 {{expected a do termination statement with a statement label '100'}} + do 100 i = 1, 10 ! expected-note {{to match this 'do'}} + if (i == 0) then ! expected-note {{to match this 'if'}} + end do ! expected-error {{expected 'end if'}} + + i = 0 + + if(i == 1) then + do i = 1, 10 ! expected-note {{to match this 'do'}} + end if ! expected-error {{expected 'end do'}} + + if(i == 1) then + do i = 1, 10 ! expected-note {{to match this 'do'}} + else ! expected-error {{expected 'end do'}} + end if + + if(i == 1) then + do 100 i = 1,10 ! expected-note {{to match this 'do'}} + else if(i == 3) then ! expected-error {{expected a do termination statement with a statement label '100'}} + end if + + do 200 i = 1,10 + do j = 1,10 ! expected-note {{to match this 'do'}} +300 print *,i +200 continue ! expected-error {{expected 'end do'}} + +100 continue +end diff --git a/test/Sema/do.f95 b/test/Sema/do.f95 index ebe5f50341..ac6accbdbf 100644 --- a/test/Sema/do.f95 +++ b/test/Sema/do.f95 @@ -12,20 +12,19 @@ PROGRAM dotest R = I * R 10 CONTINUE ! expected-note {{previous definition is here}} - END DO ! expected-error {{use of 'END DO' without the do statement}} + END DO ! expected-error {{use of 'end do' outside a do construct}} DO 10 I = 1, 5 ! expected-error {{the statement label '10' must be declared after the 'DO' statement}} 20 R = R * R DO 25 II = 1, 10 - IF(.true.) THEN -25 CONTINUE ! expected-error {{expected 'END IF'}} - END IF + IF(.true.) THEN ! expected-note {{to match this 'if'}} +25 CONTINUE ! expected-error {{expected 'end if'}} DO 666 I = 1, 10,2 ! expected-error {{use of undeclared statement label '666'}} - R = I * R - - END DO ! expected-error {{expected a statement with a statement label '666' to mark the end of a do loop}} + R = I * R ! expected-note@-1 {{to match this 'do'}} + END DO ! expected-error {{expected a do termination statement with a statement label '666'}} + CONTINUE ! expected-error@-1 {{use of 'end do' outside a do construct}} DO 30 C = 1, 3 ! expected-error {{statement requires an integer variable ('complex' invalid)}} 30 CONTINUE diff --git a/test/Sema/dowhile.f95 b/test/Sema/dowhile.f95 index 938a3c2fee..6583c6de3b 100644 --- a/test/Sema/dowhile.f95 +++ b/test/Sema/dowhile.f95 @@ -8,8 +8,8 @@ PROGRAM dowhiletest END DO IF(.true.) THEN - DO WHILE(.false.) + DO WHILE(.false.) ! expected-note {{to match this 'do'}} - END IF ! expected-error {{expected 'END DO'}} + END IF ! expected-error {{expected 'end do'}} -END ! expected-error {{expected 'END DO'}} +END diff --git a/test/Sema/if.f95 b/test/Sema/if.f95 index e5b8e40b5a..679711c6bc 100644 --- a/test/Sema/if.f95 +++ b/test/Sema/if.f95 @@ -10,9 +10,9 @@ PROGRAM iftest I = 2 END IF - ELSE ! expected-error {{'ELSE' statement must be a part of an if construct}} - ELSE IF(2 == 2) THEN ! expected-error {{'ELSE IF' statement must be a part of an if construct}} - END IF ! expected-error {{'END IF' statement must be a part of an if construct}} + ELSE ! expected-error {{use of 'else' outside an if construct}} + ELSE IF(2 == 2) THEN ! expected-error {{use of 'else if' outside an if construct}} + END IF ! FIXME: report as out of place end if? IF(2) THEN ! expected-error {{statement requires an expression of logical type ('integer' invalid)}} I = 3 @@ -28,8 +28,4 @@ PROGRAM iftest I = 3 END IF - IF(.true.) THEN - DO I = 1, 10 - END IF ! expected-error {{expected 'END DO'}} - -END PROGRAM ! expected-error {{expected 'END DO'}} +END PROGRAM diff --git a/test/Sema/subprogram.f95 b/test/Sema/subprogram.f95 index fd21665569..88d51a68ab 100644 --- a/test/Sema/subprogram.f95 +++ b/test/Sema/subprogram.f95 @@ -22,8 +22,9 @@ END SUBROUTINE SUBB ! expected-note {{previous definition is here}} INTEGER SUBB ! expected-error {{redefinition of 'subb'}} REAL FUNC2 - IF(SUBB .EQ. 0) FUNC2 = 0 ! expected-error {{expected a variable}} -END ! expected-error {{expected 'END IF'}} + LOGICAL L + L = SUBB .EQ. 0 ! expected-error {{expected a variable}} +END FUNCTION FUNC3() INTEGER FUNC3 |