[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)

Yutong Zhu via cfe-commits cfe-commits at lists.llvm.org
Mon Mar 2 10:51:44 PST 2026


================
@@ -481,3 +481,18 @@ int test26(short n) {
   return ~n == 32768; // expected-warning {{result of comparison of 16-bit signed value == 32768 is always false}}
 }
 #endif
+
+typedef unsigned long __attribute__((__vector_size__(8))) W;
+void test27(void) {
+  int i;
+  W g;
+  // We expect no assertion failures here.
+  W w = i == (-g); // expected-warning {{}}
+}
+
+void test28(void) {
+  int i;
+  W g;
+  // We expect no assertion failures here.
+  W w = i == (~g); // expected-warning {{}}
+}
----------------
YutongZhuu wrote:

Done.

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


More information about the cfe-commits mailing list