You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[Flang][OpenMP] fix crash on sematic error in atomic capture clause (#140710)
Fix a crash caused by an invalid expression in the atomic capture
clause, due to the `checkForSymbolMatch` function not accounting for
`GetExpr` potentially returning null.
Fix#139884
// ATOMIC CAPTURE construct is of the form [update-stmt, capture-stmt]
2939
-
CheckAtomicUpdateStmt(stmt1);
2940
-
CheckAtomicCaptureStmt(stmt2);
2941
-
// Variable updated in stmt1 should be captured in stmt2
2942
-
auto *v{stmt1Var.typedExpr.get()};
2943
-
auto *e{stmt2Expr.typedExpr.get()};
2944
-
if (v && e && !(v->v == e->v)) {
2945
-
context_.Say(stmt1Var.GetSource(),
2946
-
"Updated variable/array element/derived-type component %s expected to be captured in the second statement of ATOMIC CAPTURE construct"_err_en_US,
2947
-
stmt1Var.GetSource());
2952
+
"Invalid ATOMIC CAPTURE construct statements. Expected one of [update-stmt, capture-stmt], [capture-stmt, update-stmt], or [capture-stmt, write-stmt]"_err_en_US);
2948
2953
}
2949
-
} else {
2950
-
context_.Say(stmt1Expr.source,
2951
-
"Invalid ATOMIC CAPTURE construct statements. Expected one of [update-stmt, capture-stmt], [capture-stmt, update-stmt], or [capture-stmt, write-stmt]"_err_en_US);
0 commit comments