llvm-project/flang/test/Semantics/label03.f90
Andrzej Warzynski 96d229c9ab [flang][driver] Add options for unparsing
This patch adds the following compiler frontend driver options:
  * -fdebug-unparse (f18 spelling: -funparse)
  * -fdebug-unparse-with-symbols (f18 spelling: -funparse-with-symbols)
The new driver will only accept the new spelling. `f18` will accept both
the original and the new spelling.

A new base class for frontend actions is added: `PrescanAndSemaAction`.
This is added to reduce code duplication that otherwise these new
options would lead to. Implementation from
  * `ParseSyntaxOnlyAction::ExecutionAction`
is moved to:
  * `PrescanAndSemaAction::BeginSourceFileAction`
This implementation is now shared between:
  * PrescanAndSemaAction
  * ParseSyntaxOnlyAction
  * DebugUnparseAction
  * DebugUnparseWithSymbolsAction

All tests that don't require other yet unimplemented options are
updated. This way `flang-new -fc1` is used instead of `f18` when
`FLANG_BUILD_NEW_DRIVER` is set to `On`. In order to facilitate this,
`%flang_fc1` is added in the LIT configuration (lit.cfg.py).

`asFortran` from f18.cpp is duplicated as `getBasicAsFortran` in
FrontendOptions.cpp. At this stage it's hard to find a good place to
share this method. I suggest that we revisit this once a switch from
`f18` to `flang-new` is complete.

Differential Revision: https://reviews.llvm.org/D96483
2021-02-16 09:32:51 +00:00

38 lines
799 B
Fortran

! RUN: not %flang_fc1 -fdebug-unparse-with-symbols %s 2>&1 | FileCheck %s
! CHECK: DO loop doesn't properly nest
! CHECK: DO loop conflicts
! CHECK: Label '30' cannot be found
! CHECK: Label '40' cannot be found
! CHECK: Label '50' doesn't lexically follow DO stmt
subroutine sub00(a,b,n,m)
real a(n,m)
real b(n,m)
do 10 i = 1, m
do 20 j = 1, n
a(i,j) = b(i,j) + 2.0
10 continue
20 continue
end subroutine sub00
subroutine sub01(a,b,n,m)
real a(n,m)
real b(n,m)
do 30 i = 1, m
do 40 j = 1, n
a(i,j) = b(i,j) + 10.0
35 continue
45 continue
end subroutine sub01
subroutine sub02(a,b,n,m)
real a(n,m)
real b(n,m)
50 continue
do 50 i = 1, m
do 60 j = 1, n
a(i,j) = b(i,j) + 20.0
60 continue
end subroutine sub02