From dba93d3fbeceebb77956afe0293bc358cb4057e3 Mon Sep 17 00:00:00 2001 From: Eric Schweitz Date: Tue, 11 Sep 2018 16:26:19 -0700 Subject: [PATCH] [flang] Fixes the Label vs. IntLiteralConstant issue flang-compiler/f18#180 Original-commit: flang-compiler/f18@40387158dc33ae4623bef89d4509fb682feba82b Reviewed-on: https://github.com/flang-compiler/f18/pull/181 Tree-same-pre-rewrite: false --- flang/lib/parser/grammar.h | 4 ++-- flang/lib/semantics/resolve-labels.cc | 10 ---------- 2 files changed, 2 insertions(+), 12 deletions(-) diff --git a/flang/lib/parser/grammar.h b/flang/lib/parser/grammar.h index 034171f26a60..8940d1950b27 100644 --- a/flang/lib/parser/grammar.h +++ b/flang/lib/parser/grammar.h @@ -2629,8 +2629,8 @@ TYPE_CONTEXT_PARSER("PRINT statement"_en_US, "PRINT" >> format, defaulted("," >> nonemptyList(outputItem)))) // R1215 format -> default-char-expr | label | * -TYPE_PARSER(construct(defaultCharExpr / !"="_tok) || - construct(label) || construct(star)) +TYPE_PARSER(construct(label) || + construct(defaultCharExpr / !"="_tok) || construct(star)) // R1216 input-item -> variable | io-implied-do TYPE_PARSER(construct(variable) || diff --git a/flang/lib/semantics/resolve-labels.cc b/flang/lib/semantics/resolve-labels.cc index 66d1ab6a6213..54ee29e50c68 100644 --- a/flang/lib/semantics/resolve-labels.cc +++ b/flang/lib/semantics/resolve-labels.cc @@ -337,19 +337,9 @@ public: void Post(const parser::EndLabel &endLabel) { addLabelReference(endLabel.v); } void Post(const parser::EorLabel &eorLabel) { addLabelReference(eorLabel.v); } void Post(const parser::Format &format) { - // BUG: the label is saved as an IntLiteralConstant rather than a Label -#if 0 if (const auto *P{std::get_if(&format.u)}) { addLabelReferenceFromFormatStmt(*P); } -#else - if (const auto *P{std::get_if<0>(&format.u)}) { - addLabelReferenceFromFormatStmt( - parser::Label{std::get<0>(std::get( - std::get((*P->thing).u).u) - .t)}); - } -#endif } void Post(const parser::CycleStmt &cycleStmt) { if (cycleStmt.v.has_value()) {