From a25465353658a409308d011efe3e5e0eb44c53a3 Mon Sep 17 00:00:00 2001 From: vdonaldson <37090318+vdonaldson@users.noreply.github.com> Date: Wed, 3 Jul 2019 09:59:59 -0700 Subject: [PATCH] [flang] A minimal PRINT Enter function requires a minimal PRINT Leave function. (flang-compiler/f18#543) Fixes flang-compiler/f18#541 Original-commit: flang-compiler/f18@8f3c5481e15409b24fcf04c7b0e66f96e069bb4d Reviewed-on: https://github.com/flang-compiler/f18/pull/543 --- flang/lib/semantics/check-io.cc | 4 ++++ flang/lib/semantics/check-io.h | 1 + flang/test/semantics/io04.f90 | 4 ++++ 3 files changed, 9 insertions(+) diff --git a/flang/lib/semantics/check-io.cc b/flang/lib/semantics/check-io.cc index a79e8b7..df9041c 100644 --- a/flang/lib/semantics/check-io.cc +++ b/flang/lib/semantics/check-io.cc @@ -497,6 +497,10 @@ void IoChecker::Leave(const parser::OpenStmt &stmt) { stmt_ = IoStmtKind::None; } +void IoChecker::Leave(const parser::PrintStmt &stmt) { + stmt_ = IoStmtKind::None; +} + void IoChecker::Leave(const parser::ReadStmt &stmt) { if (!flags_.test(Flag::IoControlList)) { return; diff --git a/flang/lib/semantics/check-io.h b/flang/lib/semantics/check-io.h index e21f36d..a462e45 100644 --- a/flang/lib/semantics/check-io.h +++ b/flang/lib/semantics/check-io.h @@ -78,6 +78,7 @@ public: void Leave(const parser::FlushStmt &); void Leave(const parser::InquireStmt &); void Leave(const parser::OpenStmt &); + void Leave(const parser::PrintStmt &); void Leave(const parser::ReadStmt &); void Leave(const parser::RewindStmt &); void Leave(const parser::WaitStmt &); diff --git a/flang/test/semantics/io04.f90 b/flang/test/semantics/io04.f90 index f5bb78d..0fbe742 100644 --- a/flang/test/semantics/io04.f90 +++ b/flang/test/semantics/io04.f90 @@ -21,6 +21,7 @@ integer*8 stat8 integer :: iunit = 10 integer, parameter :: junit = 11 + integer, pointer :: a(:) namelist /nnn/ nn1, nn2 @@ -58,6 +59,9 @@ print* print*, 'Ok' + allocate(a(2), stat=stat2) + allocate(a(8), stat=stat8) + !ERROR: Duplicate UNIT specifier write(internal_file, unit=*) -- 2.7.4