https://gcc.gnu.org/bugzilla/show_bug.cgi?id=112773
--- Comment #8 from Robin Dapp <rdapp at gcc dot gnu.org> --- Thanks for the testcase. It looks pretty similar to the situation why I introduced the bitmask extract in the first place and I don't think that's the root cause. As last time the problem is that the generic bit_field_ref expansion code does not handle bitmask extraction with a precision < 8 very well and this is why we run into an assertion failure. I worked around this by providing the extract expander so we don't go down that road. The difference to before is that the bit_field_ref occurs in the epilogue (i.e. not LOOP_VINFO_FULLY_WITH_LENGTH_P) so we fall back. Maybe we can work around it by providing a fold_extract_last implementation for masks (even though the operation itself seems a bit weird). Will see how far I get with it.