2 ms·
No, that's just habit and me being slightly sloppy because it's a forum comment (same with the code style, sorry). I did expect this to be common across multipl
by geofft 11y ago
No, that's just habit and me being slightly sloppy because it's a forum comment (same with the code style, sorry). I did expect this to be common across multiple compilers, so I'm surprised it's only gcc. I'd be curious if there's a similar-in-spirit example for LLVM, since I do expect they do similar optimizations.
Looks like gcc -Wstrict-overflow=3 or higher produces a warning. Alternatively, -fno-strict-overflow disables the optimization (which is included as part of -O2 or higher).