[clang] Revert "[Clang] Fix assertion "unsigned range includes negative?" in AnalyzeComparison during Sema of vector comparison with mismatched signed/unsigned types and __builtin_convertvector " (PR #225389)
Aaron Ballman via cfe-commits
cfe-commits at lists.llvm.org
Tue Sep 22 06:02:40 PDT 2026
https://github.com/AaronBallman created https://github.com/llvm/llvm-project/pull/225389
Reverts llvm/llvm-project#182627
Post-commit CI found issues: https://lab.llvm.org/buildbot/#/builders/225/builds/19103
>From 91f23604545c408ae18ff533d6e1ef9e9e85c453 Mon Sep 17 00:00:00 2001
From: Aaron Ballman <aaron at aaronballman.com>
Date: Tue, 22 Sep 2026 09:02:04 -0400
Subject: [PATCH] =?UTF-8?q?Revert=20"[Clang]=20Fix=20assertion=20"unsigned?=
=?UTF-8?q?=20range=20includes=20negative=3F"=20in=20AnalyzeC=E2=80=A6"?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
This reverts commit cec2eeb8ff2f1075b036d9bfd06c365d006bc972.
---
clang/docs/ReleaseNotes.md | 5 ---
clang/test/Sema/compare.c | 62 ++------------------------------------
2 files changed, 2 insertions(+), 65 deletions(-)
diff --git a/clang/docs/ReleaseNotes.md b/clang/docs/ReleaseNotes.md
index da561d8b57204..ba944a62a1fff 100644
--- a/clang/docs/ReleaseNotes.md
+++ b/clang/docs/ReleaseNotes.md
@@ -284,11 +284,6 @@ features cannot lower the translation-unit ABI level;
### Improvements to Clang's diagnostics
-- Clang now doesn't throw assertion errors when comparing unsigned vector types
- (#GH173614).
-
-- `-Wfortify-source` now diagnoses when `strlcat` or `__builtin_strlcat` is called with a size
- argument larger than the destination buffer.
- `-Wfortify-source` now diagnoses when `strlcat`, `__builtin_strlcat`, `strlcpy`, or
`__builtin_strlcpy` is called with a size argument larger than the destination buffer.
diff --git a/clang/test/Sema/compare.c b/clang/test/Sema/compare.c
index 54cc3ffcaf5dc..d01c33d61dc8c 100644
--- a/clang/test/Sema/compare.c
+++ b/clang/test/Sema/compare.c
@@ -1,6 +1,5 @@
-// RUN: %clang_cc1 -triple x86_64-apple-darwin -fsyntax-only -pedantic -verify -Wsign-compare -Wtautological-constant-in-range-compare %s -Wno-unreachable-code -fenable-matrix -DTEST=1
-// RUN: %clang_cc1 -triple x86_64-apple-darwin -fsyntax-only -pedantic -verify -Wsign-compare -Wtype-limits %s -Wno-unreachable-code -fenable-matrix -DTEST=2
-// RUN: %clang_cc1 -triple aarch64-none-linux-gnu -target-feature +sve -pedantic -verify -Wsign-compare -Wtype-limits -fsyntax-only %s -fenable-matrix -DTEST=3
+// RUN: %clang_cc1 -triple x86_64-apple-darwin -fsyntax-only -pedantic -verify -Wsign-compare -Wtautological-constant-in-range-compare %s -Wno-unreachable-code -DTEST=1
+// RUN: %clang_cc1 -triple x86_64-apple-darwin -fsyntax-only -pedantic -verify -Wsign-compare -Wtype-limits %s -Wno-unreachable-code -DTEST=2
int test(char *C) { // nothing here should warn.
return C != ((void*)0);
@@ -483,63 +482,6 @@ int test26(short n) {
}
#endif
-typedef unsigned long __attribute__((__vector_size__(8))) V;
-
-void test27(void) {
- int i;
- V v;
-
- V v1 = i == (-v);
- // expected-warning at -1 {{comparison of integers of different signs: 'int' and 'V'}}
-
- V v2 = i == (+v);
- // expected-warning at -1 {{comparison of integers of different signs: 'int' and 'V'}}
-
- V v3 = i == (~v);
- // expected-warning at -1 {{comparison of integers of different signs: 'int' and 'V'}}
-
- V v4 = i == (!v);
- // expected-error at -1 {{invalid argument type 'V' (vector of 1 'unsigned long' value) to unary expression}}
-
- V v5 = i == (++v);
- // expected-error at -1 {{cannot increment value of type 'V'}}
-
- V v6 = i == (v++);
- // expected-error at -1 {{cannot increment value of type 'V'}}
-
- V v7 = i == (--v);
- // expected-error at -1 {{cannot decrement value of type 'V'}}
-
- V v8 = i == (v--);
- // expected-error at -1 {{cannot decrement value of type 'V'}}
-
- V v9 = i == (*v);
- // expected-error at -1 {{indirection requires pointer operand ('V' (vector of 1 'unsigned long' value) invalid)}}
-}
-
-typedef unsigned long __attribute__((matrix_type(8, 8))) M;
-
-void test28(void) {
- int i;
- M m;
-
- M m1 = i == (-m);
- // expected-error at -1 {{invalid argument type 'M' (aka 'unsigned long __attribute__((matrix_type(8, 8)))') to unary expression}}
- M m2 = i == (~m);
- // expected-error at -1 {{invalid argument type 'M' (aka 'unsigned long __attribute__((matrix_type(8, 8)))') to unary expression}}
-}
-
-#if TEST == 3
-#include <arm_sve.h>
-void test29(void) {
- int i;
- svuint8_t v = svdup_u8(5);
- svuint8_t v1 = i == (-v);
- // expected-error at -1 {{cannot convert between scalar type 'int' and vector type 'svuint8_t' (aka '__SVUint8_t') as implicit conversion would cause truncation}}
- svuint8_t v2 = i == (~v);
- // expected-error at -1 {{cannot convert between scalar type 'int' and vector type 'svuint8_t' (aka '__SVUint8_t') as implicit conversion would cause truncation}}
-}
-#endif
// GH203575
typedef unsigned gh203575_uvec __attribute__((__vector_size__(sizeof(int))));
More information about the cfe-commits
mailing list