Skip to content

Commit 09d3b77

Browse files
author
Stefan
committed
i386-asm.s: 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.
1 parent de8c19e commit 09d3b77

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

i386-asm.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -722,7 +722,7 @@ ST_FUNC void asm_opcode(TCCState *s1, int opcode)
722722
}
723723
parse_operand(s1, pop);
724724
if (tok == ':') {
725-
if (pop->type != OP_SEG || seg_prefix)
725+
if (!(pop->type & OP_SEG) || seg_prefix)
726726
tcc_error("incorrect prefix");
727727
seg_prefix = segment_prefixes[pop->reg];
728728
next();
@@ -852,7 +852,7 @@ ST_FUNC void asm_opcode(TCCState *s1, int opcode)
852852
if (opcode >= TOK_ASM_first && opcode <= TOK_ASM_last) {
853853
int b;
854854
b = op0_codes[opcode - TOK_ASM_first];
855-
if (b & 0xff00)
855+
if (b & 0xff00)
856856
g(b >> 8);
857857
g(b);
858858
return;

0 commit comments

Comments
 (0)