[PATCH] D92634: [Analyzer] Diagnose signed integer overflow
Daniel Marjamäki via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Mon Jan 4 07:33:11 PST 2021
danielmarjamaki added a comment.
> However, the mainstream compilers like GCC and Clang implement this as the overflowed value, and some programmers also use this feature to do some tricky things.
hmm.. you mean if some -fwrapv flag is used right. yes I should disable this checking then.
For information, I am not very worried about signed integer overflow. I am mostly worried about the compiler optimisations. If the compiler determines that there is signed integer overflow in a execution path and removes all code in that path.
I was inspired by this blog post: https://www.airs.com/blog/archives/120
This function:
int f(int x) { return 0x7ffffff0 < x && x + 32 < 0x7fffffff; }
might be optimized to:
int f(int x) { return 0; }
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D92634/new/
https://reviews.llvm.org/D92634
More information about the cfe-commits
mailing list