[flang] Semantic checks to see if a DO variable is modified
authorPete Steinfeld <psteinfeld@nvidia.com>
Sat, 7 Dec 2019 03:59:54 +0000 (19:59 -0800)
committerPete Steinfeld <psteinfeld@nvidia.com>
Tue, 24 Dec 2019 23:16:36 +0000 (15:16 -0800)
commit611db270f656694c776fe224b4f6e741f488f907
treeef75743b1c2a9888b8d9f483ac256e4791a6601f
parent17fdc5cc63ba04bc9929d5f02a8ff8c4412c178e
[flang] Semantic checks to see if a DO variable is modified

I added infrastructure to SemanticsContext to track active DO variables
and the source locations where they appear in DO statements.  I also
added code to semantics.[h,cc] to check to see if a DO variable is
already defined, and, if so, to emit an error message along with a
reference to the relevant DO construct.  I also added calls to several
places where variables are defined to determine if the definitions are
happening in the context of an active DO construct.

I have not yet added the checks for DO variables being redefined when passing
them as actual arguments to dummy arguments with INTENT(OUT) or INTENT(INOUT).
I wanted to get these changes merged first and catch up with the other changes
in master.

Original-commit: flang-compiler/f18@1bbfcca61b94dccfbbe943b511f846acc1c33997
Reviewed-on: https://github.com/flang-compiler/f18/pull/860
flang/lib/semantics/check-allocate.cc
flang/lib/semantics/check-deallocate.cc
flang/lib/semantics/check-do.cc
flang/lib/semantics/check-do.h
flang/lib/semantics/check-io.cc
flang/lib/semantics/semantics.cc
flang/lib/semantics/semantics.h
flang/test/semantics/CMakeLists.txt
flang/test/semantics/dosemantics12.f90 [new file with mode: 0644]