[all-commits] [llvm/llvm-project] b54260: [clang][StaticAnalysis] Fix an false negative bug ...
Ziqing Luo via All-commits
all-commits at lists.llvm.org
Fri Aug 7 14:45:53 PDT 2026
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: b542602195b54a823f0b80d1b4ab25ff3cdb2c8f
https://github.com/llvm/llvm-project/commit/b542602195b54a823f0b80d1b4ab25ff3cdb2c8f
Author: Ziqing Luo <ziqing_luo at apple.com>
Date: 2026-08-07 (Fri, 07 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' (#214553)
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'.
rdar://184263112
---------
Co-authored-by: Balázs Benics <benicsbalazs at gmail.com>
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