https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66048
--- Comment #3 from Uroš Bizjak <ubizjak at gmail dot com> --- (In reply to Ilya Enkovich from comment #2) > (In reply to Uroš Bizjak from comment #1) > > There is a *very* picky assert in mode-switching.c that otherwise allows > > various exceptions when expected sequence: > > > > (set (reg X) ...) > > > > (use (reg X)) > > With MPX we have multiple (use (reg X)) and only the last one is examined. > It is always the one created for bounds. Simple swap makes it work. With > this patch test passes: Yes, this could also work. BND registers do not (and should not) require any mode switching, while return reg could need mode switch. So, return reg should be the last one.