Skip to content

Commit

Permalink
[flang] Fix move-assign operator for struct IncrementLoopInfo (#74137)
Browse files Browse the repository at this point in the history
  • Loading branch information
kparzysz committed Dec 4, 2023
1 parent c556c9c commit dd376f8
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions flang/lib/Lower/Bridge.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -82,12 +82,12 @@ struct IncrementLoopInfo {
explicit IncrementLoopInfo(Fortran::semantics::Symbol &sym, const T &lower,
const T &upper, const std::optional<T> &step,
bool isUnordered = false)
: loopVariableSym{sym}, lowerExpr{Fortran::semantics::GetExpr(lower)},
: loopVariableSym{&sym}, lowerExpr{Fortran::semantics::GetExpr(lower)},
upperExpr{Fortran::semantics::GetExpr(upper)},
stepExpr{Fortran::semantics::GetExpr(step)}, isUnordered{isUnordered} {}

IncrementLoopInfo(IncrementLoopInfo &&) = default;
IncrementLoopInfo &operator=(IncrementLoopInfo &&x) { return x; }
IncrementLoopInfo &operator=(IncrementLoopInfo &&x) = default;

bool isStructured() const { return !headerBlock; }

Expand All @@ -102,7 +102,7 @@ struct IncrementLoopInfo {
}

// Data members common to both structured and unstructured loops.
const Fortran::semantics::Symbol &loopVariableSym;
const Fortran::semantics::Symbol *loopVariableSym;
const Fortran::lower::SomeExpr *lowerExpr;
const Fortran::lower::SomeExpr *upperExpr;
const Fortran::lower::SomeExpr *stepExpr;
Expand Down Expand Up @@ -1737,7 +1737,7 @@ class FirConverter : public Fortran::lower::AbstractConverter {
bounds->step);
if (unstructuredContext) {
maybeStartBlock(preheaderBlock);
info.hasRealControl = info.loopVariableSym.GetType()->IsNumeric(
info.hasRealControl = info.loopVariableSym->GetType()->IsNumeric(
Fortran::common::TypeCategory::Real);
info.headerBlock = headerBlock;
info.bodyBlock = bodyBlock;
Expand Down Expand Up @@ -1827,7 +1827,7 @@ class FirConverter : public Fortran::lower::AbstractConverter {
mlir::Location loc = toLocation();
for (IncrementLoopInfo &info : incrementLoopNestInfo) {
info.loopVariable =
genLoopVariableAddress(loc, info.loopVariableSym, info.isUnordered);
genLoopVariableAddress(loc, *info.loopVariableSym, info.isUnordered);
mlir::Value lowerValue = genControlValue(info.lowerExpr, info);
mlir::Value upperValue = genControlValue(info.upperExpr, info);
bool isConst = true;
Expand Down

0 comments on commit dd376f8

Please sign in to comment.