https://gcc.gnu.org/bugzilla/show_bug.cgi?id=23384
--- Comment #9 from Martin Sebor <msebor at gcc dot gnu.org> --- As a data point, Clang manages to optimize at least the simple case in bug 81788 as expected. No other compiler I've tested does (IBM XLC, Intel ICC, Visual Studio, or Sun/Oracle Studio).