i386-asm.c: Do bit-check for OP_SEG in asm_opcode

Fix a bug with "call *%%gs:16", which sets the two flags OP_INDIR and
OP_SEG in pop->type.
This commit is contained in:
Stefan 2025-09-21 10:47:33 +02:00
parent de8c19e1da
commit 9dc59f9c23

View File

@ -722,7 +722,7 @@ ST_FUNC void asm_opcode(TCCState *s1, int opcode)
} }
parse_operand(s1, pop); parse_operand(s1, pop);
if (tok == ':') { if (tok == ':') {
if (pop->type != OP_SEG || seg_prefix) if (!(pop->type & OP_SEG) || seg_prefix)
tcc_error("incorrect prefix"); tcc_error("incorrect prefix");
seg_prefix = segment_prefixes[pop->reg]; seg_prefix = segment_prefixes[pop->reg];
next(); next();