https://gcc.gnu.org/bugzilla/show_bug.cgi?id=15826
Martin Sebor <msebor at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED CC| |msebor at gcc dot gnu.org Known to work| |5.1.0, 6.0 Resolution|--- |FIXED --- Comment #11 from Martin Sebor <msebor at gcc dot gnu.org> --- It looks to me like the missing optimization now takes place, and has since 5.1. In both foo() and andrew() the bit test is optimized away during cddce2 resulting in the following. The BIT_FIELD_REF is still there, but I assume that's fine. I'll go ahead, add the test case to the test suite and resolve this as fixed. Please reopen if I missed something. foo (struct s * p) { unsigned char _4; _Bool _6; unsigned int _7; <bb 2>: _4 = BIT_FIELD_REF <*p_3(D), 8, 0>; _6 = (_Bool) _4; _7 = (unsigned int) _6; return _7; }