Russ Allbery wrote: > Shachar Shemesh <shac...@debian.org> writes: >> Do you really want to get a "Warning: signed integer overflow yields >> undefined behavior" on this function? > > I would certainly like to be able to enable such a thing. I write a lot > of code where I'd love the compiler to double-check that I've established > bounds checks on a and b before doing the addition that guarantee that it > won't overflow.
Not quite to that point, but you might be interested in the UBS: http://clang.llvm.org/docs/UsersManual.html#controlling-code-generation More specifically, two options: -fsanitize=undefined and -fsanitize=integer And some nice examples: http://blog.regehr.org/archives/1054 http://blog.regehr.org/archives/963 Cheers, -- Raphael Geissert - Debian Developer www.debian.org - get.debian.net -- To UNSUBSCRIBE, email to debian-devel-requ...@lists.debian.org with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org Archive: https://lists.debian.org/ligk5k$gcn$1...@ger.gmane.org