[clang] [Clang] Fix assertion "unsigned range includes negative?" in AnalyzeComparison during Sema of vector comparison with mismatched signed/unsigned types and __builtin_convertvector (PR #182627)

Aaron Ballman via cfe-commits cfe-commits at lists.llvm.org
Tue Apr 28 08:04:21 PDT 2026


================
@@ -2320,12 +2286,15 @@ bool Type::isUnsignedIntegerOrEnumerationType() const {
   if (const auto *IT = dyn_cast<DependentBitIntType>(CanonicalType))
     return IT->isUnsigned();
 
-  if (const auto *OBT = dyn_cast<OverflowBehaviorType>(CanonicalType))
-    return OBT->getUnderlyingType()->isUnsignedIntegerOrEnumerationType();
-
   return false;
 }
 
+bool Type::isUnsignedIntegerOrVectorType() const {
----------------
AaronBallman wrote:

This seems *awfully close* to how `Type::hasUnsignedIntegerRepresentation()` is defined. I'm a bit worried there's an existing issue here with scoped underlying types because: https://github.com/llvm/llvm-project/blob/d769ce21768c66a04b3e46d1b330fd29238b34a5/clang/lib/AST/Type.cpp#L2339

CC @ojhunt who has been in this area recently for OBT work.

https://github.com/llvm/llvm-project/pull/182627


More information about the cfe-commits mailing list