https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94779
--- Comment #3 from Gabriel Ravier <gabravier at gmail dot com> --- Just fyi : When I said "gcc fails to optimize this to `return x + 1`, instead opting for some rather weird code generation (involving `sbb` on x86)" the "weird code generation" I was referring to is the exact one you sent and called "fully optimized". I highly doubt this is optimal code generation over simply adding 1 to x and returning that.