From 3230a2f3cecc23d8e0d2924a699f72185494f8ee Mon Sep 17 00:00:00 2001 From: peter klausler Date: Mon, 8 Apr 2019 16:57:30 -0700 Subject: [PATCH] [flang] fix bug found in testing Original-commit: flang-compiler/f18@297ad78510e82f44a123c408561d7782c62f7bd2 Reviewed-on: https://github.com/flang-compiler/f18/pull/390 Tree-same-pre-rewrite: false --- flang/lib/parser/parse-tree.cc | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/flang/lib/parser/parse-tree.cc b/flang/lib/parser/parse-tree.cc index 9497d6421847..945d74b0bf0b 100644 --- a/flang/lib/parser/parse-tree.cc +++ b/flang/lib/parser/parse-tree.cc @@ -88,8 +88,8 @@ bool DoConstruct::IsDoConcurrent() const { } static Designator MakeArrayElementRef( - const Name &name, std::list &subscripts) { - ArrayElement arrayElement{Name{name.source}, std::list{}}; + const Name &name, std::list &&subscripts) { + ArrayElement arrayElement{DataRef{Name{name}}, std::list{}}; for (Expr &expr : subscripts) { arrayElement.subscripts.push_back(SectionSubscript{ Scalar{Integer{common::Indirection{std::move(expr)}}}}); @@ -124,7 +124,7 @@ Designator FunctionReference::ConvertToArrayElementRef() { for (auto &arg : std::get>(v.t)) { args.emplace_back(std::move(ActualArgToExpr(name.source, arg).value())); } - return MakeArrayElementRef(name, args); + return MakeArrayElementRef(name, std::move(args)); } StructureConstructor FunctionReference::ConvertToStructureConstructor( @@ -163,11 +163,10 @@ Statement StmtFunctionStmt::ConvertToAssignment() { auto &funcExpr{std::get>(t).thing}; std::list subscripts; for (Name &arg : funcArgs) { - subscripts.push_back( - Expr{common::Indirection{Designator{Name{arg.source}}}}); + subscripts.push_back(Expr{common::Indirection{Designator{Name{arg}}}}); } - auto variable{ - Variable{common::Indirection{MakeArrayElementRef(funcName, subscripts)}}}; + auto variable{Variable{common::Indirection{ + MakeArrayElementRef(funcName, std::move(subscripts))}}}; return Statement{std::nullopt, ActionStmt{common::Indirection{ AssignmentStmt{std::move(variable), std::move(funcExpr)}}}}; -- 2.34.1