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

_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to