https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101955
navidrahimi <navidrahimi at microsoft dot com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |navidrahimi at microsoft dot com --- Comment #5 from navidrahimi <navidrahimi at microsoft dot com> --- I think rather than just int f(int b) { return (((b)<<31)>>31); } We should optimize long too: int f(int b) { return (((b)<<63)>>63); } 1) https://compiler-explorer.com/z/dnrr54v4r