I expect my compiler vendor to be on my side, ie produce a compiler that helps me write good software and not get in my way. GCC is doing the opposite, it's deliberately looking to use the standard to fuck me over in the most subtle and unexpected ways. Signed integer overflow is undefined; that gives compiler authors the liberty to make it do anything they want, including well defined things that anyone would expect and find useful. But GCC decides to fuck you over so their devs can give you an arrogant reply and impose their superiority if you show up on their bug tracker.
I agree with this. Making integer overflow UB is ridiculous.
> and don't fuck up any bounds checks
But I disagree with this. That's just normal UB-based optimization, one of the point of having UB at all is to do such optimization.
With UB compilers can assume that eg 'x + 1 > x' is always true for signed integers. That allows quite a few optimizations.
Nothing in there lets the compiler get to say "this will never happen". but they do exactly this.
But "gcc -fsanitize=undefined" is just as easy to run as "gcc -O3" is.