summaryrefslogtreecommitdiffstats
path: root/clang
diff options
context:
space:
mode:
Diffstat (limited to 'clang')
-rw-r--r--clang/lib/Sema/SemaChecking.cpp2
-rw-r--r--clang/test/Sema/atomic-compare.c5
2 files changed, 6 insertions, 1 deletions
diff --git a/clang/lib/Sema/SemaChecking.cpp b/clang/lib/Sema/SemaChecking.cpp
index a64932b1c71..23a6fc3c4cd 100644
--- a/clang/lib/Sema/SemaChecking.cpp
+++ b/clang/lib/Sema/SemaChecking.cpp
@@ -6100,7 +6100,7 @@ static void DiagnoseOutOfRangeComparison(Sema &S, BinaryOperator *E,
// TODO: Investigate using GetExprRange() to get tighter bounds
// on the bit ranges.
QualType OtherT = Other->getType();
- if (const AtomicType *AT = dyn_cast<AtomicType>(OtherT))
+ if (const auto *AT = OtherT->getAs<AtomicType>())
OtherT = AT->getValueType();
IntRange OtherRange = IntRange::forValueOfType(S.Context, OtherT);
unsigned OtherWidth = OtherRange.Width;
diff --git a/clang/test/Sema/atomic-compare.c b/clang/test/Sema/atomic-compare.c
index 2eed0912602..01eb8200472 100644
--- a/clang/test/Sema/atomic-compare.c
+++ b/clang/test/Sema/atomic-compare.c
@@ -19,3 +19,8 @@ void f(_Atomic(int) a, _Atomic(int) b) {
if (!a > b) {} // no warning
if (!a > -1) {} // expected-warning {{comparison of constant -1 with boolean expression is always true}}
}
+
+typedef _Atomic(int) Ty;
+void PR23638(Ty *a) {
+ if (*a == 1) {} // no warning
+}
OpenPOWER on IntegriCloud