https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109063
Bug ID: 109063 Summary: GCC Static Analyzer evaluates `e == &d + 1` to be UNKNOWN with the fact that `e == &d` Product: gcc Version: 13.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: analyzer Assignee: dmalcolm at gcc dot gnu.org Reporter: geoffreydgr at icloud dot com Target Milestone: --- Hi, David. I found a problem that GCC Static Analyzer evaluates `e == &d + 1` to be UNKNOWN with the fact that `e == &d`. Maybe GCC Static Analyzer should have the ability to evaluates `e == &d + 1` to be FALSE ? See it live: https://godbolt.org/z/Wcd4T1jGa. Input: ```c void __analyzer_eval(); void __analyzer_describe(); void c() { int d = 42; int *e = &d; if (e == &d) { __analyzer_describe(0, e); __analyzer_describe(0, &d + 1); __analyzer_eval(e == &d + 1); __analyzer_eval(e + 1 == &d + 1); } } ``` Output: ```bash <source>: In function 'c': <source>:11:9: warning: svalue: '&d' 11 | __analyzer_describe(0, e); | ^~~~~~~~~~~~~~~~~~~~~~~~~ <source>:12:9: warning: svalue: '(&d+(sizetype)4)' 12 | __analyzer_describe(0, &d + 1); | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ <source>:14:9: warning: UNKNOWN 14 | __analyzer_eval(e == &d + 1); | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~ <source>:15:9: warning: TRUE 15 | __analyzer_eval(e + 1 == &d + 1); | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Compiler returned: 0 ```