[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:09:46 PST 2023
https://github.com/sun-jacobi created https://github.com/llvm/llvm-project/pull/71480
This PR fixes https://github.com/llvm/llvm-project/issues/69069 .
>From 265c0586330a678ef61a64c9610cf0ee7c51367f Mon Sep 17 00:00:00 2001
From: sun-jacobi <sun1011jacobi at gmail.com>
Date: Tue, 7 Nov 2023 12:06:28 +0900
Subject: [PATCH] [Clang][OpenMP]: fixed crash due to invalid binary expression
in atomic semantic checker
---
clang/lib/Sema/SemaOpenMP.cpp | 7 +++++++
1 file changed, 7 insertions(+)
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;
More information about the cfe-commits
mailing list