@@ -1127,14 +1127,6 @@ static void genOmpAtomicUpdateStatement(
11271127
11281128 mlir::Value address = fir::getBase (converter.genExprAddr (
11291129 *Fortran::semantics::GetExpr (assignmentStmtVariable), stmtCtx));
1130- const Fortran::semantics::Symbol *updateSymbol;
1131- if (auto varDesignator = std::get_if<
1132- Fortran::common::Indirection<Fortran::parser::Designator>>(
1133- &assignmentStmtVariable.u )) {
1134- if (const auto *name = getDesignatorNameIfDataRef (varDesignator->value ())) {
1135- updateSymbol = name->symbol ;
1136- }
1137- }
11381130 // If no hint clause is specified, the effect is as if
11391131 // hint(omp_sync_hint_none) had been specified.
11401132 mlir::IntegerAttr hint = nullptr ;
@@ -1161,7 +1153,15 @@ static void genOmpAtomicUpdateStatement(
11611153 firOpBuilder.createBlock (&atomicUpdateOp.getRegion (), {}, varTys, locs);
11621154 mlir::Value val =
11631155 fir::getBase (atomicUpdateOp.getRegion ().front ().getArgument (0 ));
1164- converter.bindSymbol (*updateSymbol, val);
1156+ auto varDesignator =
1157+ std::get_if<Fortran::common::Indirection<Fortran::parser::Designator>>(
1158+ &assignmentStmtVariable.u );
1159+ assert (varDesignator && " Variable designator for atomic update assignment "
1160+ " statement does not exist" );
1161+ const auto *name = getDesignatorNameIfDataRef (varDesignator->value ());
1162+ assert (name && name->symbol &&
1163+ " No symbol attached to atomic update variable" );
1164+ converter.bindSymbol (*name->symbol , val);
11651165 // Set the insert for the terminator operation to go at the end of the
11661166 // block.
11671167 mlir::Block &block = atomicUpdateOp.getRegion ().back ();
0 commit comments