[clang] [Clang][OpenMP]: fixed crash due to invalid binary expression in checking atomic semantics (PR #71480)
via cfe-commits
cfe-commits at lists.llvm.org
Mon Nov 6 19:10:16 PST 2023
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-clang
Author: Chia (sun-jacobi)
<details>
<summary>Changes</summary>
This PR fixes https://github.com/llvm/llvm-project/issues/69069 .
---
Full diff: https://github.com/llvm/llvm-project/pull/71480.diff
1 Files Affected:
- (modified) clang/lib/Sema/SemaOpenMP.cpp (+7)
``````````diff
diff --git a/clang/lib/Sema/SemaOpenMP.cpp b/clang/lib/Sema/SemaOpenMP.cpp
index 1bd34f73e5f7e00..e05fa54d8118319 100644
--- a/clang/lib/Sema/SemaOpenMP.cpp
+++ b/clang/lib/Sema/SemaOpenMP.cpp
@@ -11605,6 +11605,9 @@ class OpenMPAtomicUpdateChecker {
/// RHS binary operation does not have reference to the updated LHS
/// part.
NotAnUpdateExpression,
+ /// An expression contains semantical error not related to
+ /// 'omp atomic [update]'
+ NotAValidExpression,
/// No errors is found.
NoError
};
@@ -11782,6 +11785,10 @@ bool OpenMPAtomicUpdateChecker::checkStatement(Stmt *S, unsigned DiagId,
ErrorFound = NotABinaryOrUnaryExpression;
NoteLoc = ErrorLoc = AtomicBody->getExprLoc();
NoteRange = ErrorRange = AtomicBody->getSourceRange();
+ } else if (AtomicBody->containsErrors()) {
+ ErrorFound = NotAValidExpression;
+ NoteLoc = ErrorLoc = AtomicBody->getExprLoc();
+ NoteRange = ErrorRange = AtomicBody->getSourceRange();
}
} else {
ErrorFound = NotAScalarType;
``````````
</details>
https://github.com/llvm/llvm-project/pull/71480
More information about the cfe-commits
mailing list