Skip to content

Commit

Permalink
[flang] Re-enable semantics/altreturn{02,03} tests
Browse files Browse the repository at this point in the history
These tests were disabled due to flang-compiler/f18#407.
Previously these tests caused F18 to crash as the feature was not fully
implemented.

The altreturn feature is now implemented, so these tests can be
re-enabled. altreturn03 tested some negative cases which F18 correctly
diagnoses. Modified that test to expect these new error messages. Also
make the later cases in the test reachable.

These tests can now be ported by the script to lit-style tests.

Change-Id: Ib336c10d55068d9a26fc2deb43ad052e74e73456

Original-commit: flang-compiler/f18@4de19d7
Reviewed-on: flang-compiler/f18#1027
Tree-same-pre-rewrite: false
  • Loading branch information
LukeIreland1 authored and memfrob committed Oct 4, 2022
1 parent f3d3398 commit 4b0cc46
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 9 deletions.
5 changes: 2 additions & 3 deletions flang/test/Semantics/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -131,9 +131,8 @@ set(ERROR_TESTS
deallocate05.f90
coarrays01.f90
altreturn01.f90
# Issue 407
# altreturn02.f90
# altreturn03.f90
altreturn02.f90
altreturn03.f90
altreturn04.f90
altreturn05.f90
allocate01.f90
Expand Down
15 changes: 9 additions & 6 deletions flang/test/Semantics/altreturn03.f90
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,14 @@ SUBROUTINE TEST (N, *, *)
IF ( N .EQ. 1 ) RETURN 1
IF ( N .EQ. 2 ) RETURN 2
IF ( N .EQ. 3 ) RETURN 3
IF ( N .EQ. 3 ) RETURN N
IF ( N .EQ. 3 ) RETURN N * N
IF ( N .EQ. 3 ) RETURN B(N)
IF ( N .EQ. 3 ) RETURN B
IF ( N .EQ. 3 ) RETURN R
IF ( N .EQ. 3 ) RETURN Z
IF ( N .EQ. 4 ) RETURN N
IF ( N .EQ. 5 ) RETURN N * N
IF ( N .EQ. 6 ) RETURN B(N)
!ERROR: Must be a scalar value, but is a rank-1 array
IF ( N .EQ. 7 ) RETURN B
!ERROR: Must have INTEGER type, but is REAL(4)
IF ( N .EQ. 8 ) RETURN R
!ERROR: Must have INTEGER type, but is COMPLEX(4)
IF ( N .EQ. 9 ) RETURN Z
RETURN 2
END

0 comments on commit 4b0cc46

Please sign in to comment.