[clang] [analyzer] Demonstrate superfluous unsigned >= 0 assumption (PR #78442)

via cfe-commits cfe-commits at lists.llvm.org
Wed Mar 6 05:59:38 PST 2024


=?utf-8?q?Donát?= Nagy <donat.nagy at ericsson.com>,
=?utf-8?q?Donát?= Nagy <donat.nagy at ericsson.com>
Message-ID:
In-Reply-To: <llvm.org/llvm/llvm-project/pull/78442 at github.com>


NagyDonat wrote:

Thanks for the approval; I forgot about this issue a few weeks ago.

Now that you reminded me, I tried to research its cause and dropped a FIXME onto the statement that is not sound logically. Unfortunately I don't see an easy solution for this issue (apart from a ham-fisted hack that explicitly handles comparisons between unsigned values and zero as a special case).

I considered a completely different logic for the `IsAssuming` check: instead of checking for a change in constraints or an unknown opaque value, we could look for a branching point in the exploded graph. However, I fear that the exploded graph is complicated and a bit "magical" so implementing this completely correctly could waste lots of time.

As the only effect of this bug is a slightly inaccurate message, I feel that it's low priority and it's not worth to work on it. I think I would like to merge this testcase and FIXME (mainly to mark that this issue is already known), and then switch to different tasks.

I tried to look for an existing test file where I could place this testcase but I didn't find anything that's clearly connected to this issue, so I think it's better to keep this in a separate file. (But if you can suggest a file where I could place this, then I'm happy to do so.) 

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


More information about the cfe-commits mailing list