+ snprintf (name, REGNAMESZ, "??? 0x%x", regno);
Always use %#x rather than 0x%x. But here you should not be doing this
way at all. Just do:
snprintf (name, REGNAMESZ, "reg%u", loc == NULL ? regno : loc->regno);
But, in fact, this looks like there was a latent bug already. It should
not be using LOC->regno at all, but just always REGNO here.