[flang] Fixes the Label vs. IntLiteralConstant issue flang-compiler/f18#180

Original-commit: flang-compiler/f18@40387158dc
Reviewed-on: https://github.com/flang-compiler/f18/pull/181
Tree-same-pre-rewrite: false
This commit is contained in:
Eric Schweitz 2018-09-11 16:26:19 -07:00
parent 2e44efeea2
commit dba93d3fbe
2 changed files with 2 additions and 12 deletions

View File

@ -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<Format>(defaultCharExpr / !"="_tok) ||
construct<Format>(label) || construct<Format>(star))
TYPE_PARSER(construct<Format>(label) ||
construct<Format>(defaultCharExpr / !"="_tok) || construct<Format>(star))
// R1216 input-item -> variable | io-implied-do
TYPE_PARSER(construct<InputItem>(variable) ||

View File

@ -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<parser::Label>(&format.u)}) {
addLabelReferenceFromFormatStmt(*P);
}
#else
if (const auto *P{std::get_if<0>(&format.u)}) {
addLabelReferenceFromFormatStmt(
parser::Label{std::get<0>(std::get<parser::IntLiteralConstant>(
std::get<parser::LiteralConstant>((*P->thing).u).u)
.t)});
}
#endif
}
void Post(const parser::CycleStmt &cycleStmt) {
if (cycleStmt.v.has_value()) {