0
0
mirror of https://github.com/netwide-assembler/nasm.git synced 2025-07-24 10:25:42 -04:00

assemble: defer MERR_OPSIZEMISSING

In order for the machinery that deduces memory operand sizes when they
are not provided to work correctly, we need to make sure that
MERR_OPSIZEMISSING is only issued by matches() as the last resort;
that way all other error conditions will have been filtered out and we
know at the very end if we have exactly one option left.

This is a partial revert of cd26fccab48bc35465e68d44a7432d1b1cca4d7e,
but does not affect the functionality introduced by that patch.

Reported-by: Cyrill Gorcunov <gorcunov@gmail.com>
Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
This commit is contained in:
H. Peter Anvin (Intel) 2018-06-28 02:20:11 -07:00
parent 94acb7b5d0
commit e8ceba5979

View File

@ -2170,6 +2170,7 @@ static enum match_result matches(const struct itemplate *itemp,
insn *instruction, int bits) insn *instruction, int bits)
{ {
opflags_t size[MAX_OPERANDS], asize; opflags_t size[MAX_OPERANDS], asize;
bool opsizemissing = false;
int i, oprs; int i, oprs;
/* /*
@ -2347,7 +2348,7 @@ static enum match_result matches(const struct itemplate *itemp,
* so "missing operand size" for a register should be * so "missing operand size" for a register should be
* considered a wildcard match rather than an error. * considered a wildcard match rather than an error.
*/ */
return MERR_OPSIZEMISSING; opsizemissing = true;
} }
} else if (is_broadcast && } else if (is_broadcast &&
(brcast_num != (brcast_num !=
@ -2363,6 +2364,9 @@ static enum match_result matches(const struct itemplate *itemp,
} }
} }
if (opsizemissing)
return MERR_OPSIZEMISSING;
/* /*
* Check operand sizes * Check operand sizes
*/ */