https://github.com/huseyin-donmez updated 
https://github.com/llvm/llvm-project/pull/205017

From d86158ea51618acd0a6c684cf2b1e0bef3b216b5 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?H=C3=BCseyin=20D=C3=B6nmez?= <[email protected]>
Date: Mon, 22 Jun 2026 02:04:21 +0200
Subject: [PATCH 1/2] [Sema] Fix ICE when passing invalid types to abs and
 cause unreachable code crash

---
 clang/lib/Sema/SemaChecking.cpp       |  6 ++++++
 clang/test/Sema/builtin-abs-invalid.c | 10 ++++++++++
 2 files changed, 16 insertions(+)
 create mode 100644 clang/test/Sema/builtin-abs-invalid.c

diff --git a/clang/lib/Sema/SemaChecking.cpp b/clang/lib/Sema/SemaChecking.cpp
index ec4a9037f5c23..294729b33a6ec 100644
--- a/clang/lib/Sema/SemaChecking.cpp
+++ b/clang/lib/Sema/SemaChecking.cpp
@@ -10527,6 +10527,12 @@ void Sema::CheckAbsoluteValueFunction(const CallExpr 
*Call,
   if (IsStdAbs)
     return;
 
+  // Prevent reaching unreachable code in getAbsoluteValueKind for unsupported
+  // types.
+  if (!ArgType->isIntegralOrEnumerationType() &&
+      !ArgType->isRealFloatingType() && !ArgType->isAnyComplexType())
+    return;
+
   AbsoluteValueKind ArgValueKind = getAbsoluteValueKind(ArgType);
   AbsoluteValueKind ParamValueKind = getAbsoluteValueKind(ParamType);
 
diff --git a/clang/test/Sema/builtin-abs-invalid.c 
b/clang/test/Sema/builtin-abs-invalid.c
new file mode 100644
index 0000000000000..9ec6c0edc491a
--- /dev/null
+++ b/clang/test/Sema/builtin-abs-invalid.c
@@ -0,0 +1,10 @@
+// RUN: %clang_cc1 -triple x86_64-unknown-unknown -fsyntax-only -verify %s
+// expected-no-diagnostics
+
+int abs(int);
+
+typedef int int1 __attribute__((__vector_size__(4)));
+
+void test_vector_abs(int1 x) {
+    (void)abs(x);
+}
\ No newline at end of file

From 9b57fc3a4d394c1a7acdb2a269a6e9a6427db66f Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?H=C3=BCseyin=20D=C3=B6nmez?= <[email protected]>
Date: Mon, 22 Jun 2026 18:48:01 +0200
Subject: [PATCH 2/2] Add release note for the abs crash fix

---
 clang/docs/ReleaseNotes.rst | 1 +
 1 file changed, 1 insertion(+)

diff --git a/clang/docs/ReleaseNotes.rst b/clang/docs/ReleaseNotes.rst
index 69687db1bbedd..2dd2650b38176 100644
--- a/clang/docs/ReleaseNotes.rst
+++ b/clang/docs/ReleaseNotes.rst
@@ -846,6 +846,7 @@ Miscellaneous Clang Crashes Fixed
 - Fixed an assertion failure in ``isAtEndOfMacroExpansion`` on macro 
expansions crossing the boundary of two fileIDs. (#GH115007), (#GH21755)
 - Fixed an assertion failure when ``__builtin_dump_struct`` is used with an
   immediate-escalated callable. (#GH192846)
+- Fixed a crash when passing one sized implicitly casted vector to a 
``abs``function. (#GH204777)
 
 OpenACC Specific Changes
 ------------------------

_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to