[clang] [analyzer] EvalBinOpLL should return Unknown less often (PR #114222)

DonĂ¡t Nagy via cfe-commits cfe-commits at lists.llvm.org
Thu Oct 31 03:06:22 PDT 2024


NagyDonat wrote:

Offtopic @Xazax-hun
> there are many ways to get to undef during constant folding (signed overflows ...

I was surprised to read this because as far as I know (knew) the analyzer models signed operations as if overflow was completely natural for them. (See e.g. the method `assumeInBound` which IIRC relies on this to convert a "within this interval" check to a ">= some threshold" check. I also vaguely recall that there are many FPs where the analyzer assumes wraparond of signed values.)

I would be very grateful if somebody pointed out some logic in the analyzer source which ensures that a signed overflow produces an `UndefinedVal` (or the overflow is disallowed by some other mechanism). If I was right and we don't have such code yet, then it might be good to add some...

https://github.com/llvm/llvm-project/pull/114222


More information about the cfe-commits mailing list