https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95425
Bug ID: 95425 Summary: Failure to optimize bit twiddling on statics that does nothing Product: gcc Version: 11.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: tree-optimization Assignee: unassigned at gcc dot gnu.org Reporter: gabravier at gmail dot com Target Milestone: --- uint32_t f() { static uint32_t x = 0; x = (x >> 16) | (x << 16); return x; } This can be optimized to `return 0;`. This transformation is done by LLVM, but not by GCC.