]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commit
x86: improve matching diagnostics
authorJan Beulich <jbeulich@suse.com>
Fri, 16 May 2025 08:26:45 +0000 (10:26 +0200)
committerJan Beulich <jbeulich@suse.com>
Fri, 16 May 2025 08:26:45 +0000 (10:26 +0200)
commit73e50a730694575b3e15e1fdbf35a802888c0aa1
tree9ea59cc2709c03d70c80ff4d034b337609cbe63c
parent90a3386308e323b59eaad646f07b2c2a8ed036d4
x86: improve matching diagnostics

Many times in the past I was puzzled by seeing "operand size mismatch"
when really "operand type mismatch" would be far more appropriate. As it
turns out, there were at least two flaws: In the single operand case we
didn't propagate i.error to match_template()'s local specific_error when
noticing a type mismatch. And then operand_size_match() was too eager in
invoking match_mem_size(): Especially the Unspecified attribute can get
in the way there when the expected operand isn't a memory one (and hence
Unspecified would not be set in the operand template, whereas it's
uniformly set for memory operands in AT&T syntax).

(In the x86-64-lkgs-inval testcase the particular error for the two
bogus Intel syntax forms doesn't really matter; all we ought to care
about there isthat there is _some_ error.)
gas/config/tc-i386.c
gas/testsuite/gas/i386/i386.exp
gas/testsuite/gas/i386/inval-type.l [new file with mode: 0644]
gas/testsuite/gas/i386/inval-type.s [new file with mode: 0644]
gas/testsuite/gas/i386/x86-64-apx-pushp-popp-inval.l
gas/testsuite/gas/i386/x86-64-lkgs-inval.l