[all-commits] [llvm/llvm-project] 53ad2a: [clang][StaticAnalysis] Fix an false negative bug ...
Ziqing Luo via All-commits
all-commits at lists.llvm.org
Thu Aug 6 12:35:18 PDT 2026
Branch: refs/heads/users/ziqingluo/csa-builtin_overflow-fix
Home: https://github.com/llvm/llvm-project
Commit: 53ad2aef35542068a7f13208bbbd3adf497a21a0
https://github.com/llvm/llvm-project/commit/53ad2aef35542068a7f13208bbbd3adf497a21a0
Author: Ziqing Luo <ziqing_luo at apple.com>
Date: 2026-08-06 (Thu, 06 Aug 2026)
Changed paths:
M clang/lib/StaticAnalyzer/Checkers/BuiltinFunctionChecker.cpp
M clang/test/Analysis/builtin_overflow.c
Log Message:
-----------
[clang][StaticAnalysis] Fix an false negative bug in handling '__builtin*overflow'
For a binary operation 'A op B' and a result type 'T', these builtins
return true/false for whether the operation's result is a value 'T'
cannot hold. CSA models this by computing the operation's result in a
temporary type and comparing it against the bounds of 'T'. However,
the temporary type is only twice as wide as 'T', not the
operands. When either operand is wider than 'T's doubled width, the
result of 'A op B' can silently wrap around before the comparison,
producing a false negative.
The solution is to find the proper type to temporarily hold the result
of 'A op B' from types of 'A' and 'B'.
To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications
More information about the All-commits
mailing list