There is a "somewhat unexpected" problem:
This code:
bnd jb short cs20
mov eax, ecx
xchg esp, eax
mov eax, dword ptr [eax]
mov dword ptr [esp], eax
mov eax, esp
add eax, 4
bnd ret
cs20:
Assembles with UASM to:
004FC857 F27210 repnz jb $004fc86a
004FC85A 8BC1 mov eax,ecx
004FC85C 94 xchg eax,esp
004FC85D 8B00 mov eax,[eax]
004FC85F 890424 mov [esp],eax
004FC862 8BC4 mov eax,esp
004FC864 83C004 add eax,$04
004FC867 F2C3 repnz ret
and with MASM to:
004FC857 F2720E repnz jb $004fc868
004FC85A 8BC1 mov eax,ecx
004FC85C 94 xchg eax,esp
004FC85D 8B00 mov eax,[eax]
004FC85F 890424 mov [esp],eax
004FC862 8BC4 mov eax,esp
004FC864 83C004 add eax,$04
004FC867 C3 ret
MASM does not convert the bnd ret.
But when I run the UASM assembled code, it hangs occasionally, the MASM assembled does not hang.
The obvious reason is the "ret", because everything else is equal. Well, not exactly, there is a difference in the bnd jb short cs20 encoding as well.
May be you can find an explanation.