[clang] [Sema] Fix ICE when passing invalid types to abs #204777 (PR #205017)
Aaron Ballman via cfe-commits
cfe-commits at lists.llvm.org
Thu Jun 25 05:54:20 PDT 2026
=?utf-8?q?Hüseyin_Dönmez?= <donnmez.huseyin at gmail.com>,
=?utf-8?q?Hüseyin_Dönmez?= <donnmez.huseyin at gmail.com>
Message-ID:
In-Reply-To: <llvm.org/llvm/llvm-project/pull/205017 at github.com>
================
@@ -10608,6 +10608,12 @@ void Sema::CheckAbsoluteValueFunction(const CallExpr *Call,
if (IsStdAbs)
return;
+ // Prevent reaching unreachable code in getAbsoluteValueKind for unsupported
+ // types.
+ if (!ArgType->isIntegralOrEnumerationType() &&
----------------
AaronBallman wrote:
They are different, particularly around handling of enumerations. `getAbsoluteValueKind()` is checking for `isIntegralOrEnumerationType()` specifically, so using `isArithmeticType()` here would still hit the bug being solved.
Whether we should be using `isArithmeticType()` in both places is an interesting question, but outside the scope of this PR.
https://github.com/llvm/llvm-project/pull/205017
More information about the cfe-commits
mailing list