diff --git a/compiler/x86/rax86.pas b/compiler/x86/rax86.pas index 11c0214e33..6b9893088c 100644 --- a/compiler/x86/rax86.pas +++ b/compiler/x86/rax86.pas @@ -854,7 +854,7 @@ begin ; end; - if memoffset < 0 then + if ((operands[i].opr.ref.base=NR_ESP) or (operands[i].opr.ref.index=NR_ESP)) and (memoffset < 0) then begin Message2(asmr_w_check_mem_operand_negative_offset, //std_op2str[opcode], diff --git a/tests/webtbf/tw40113c.pp b/tests/webtbf/tw40113c.pp new file mode 100644 index 0000000000..0d7865e0a4 --- /dev/null +++ b/tests/webtbf/tw40113c.pp @@ -0,0 +1,17 @@ +{ %cpu=x86_64 } +{ %opt=-Sew } +{ %fail } + +{$asmmode intel} +begin + asm + movss xmm0, dword ptr [rsp-8] // (2) + lea rax, @table[rip] + lea rsp, [rsp+32] + jmp @next + db 0, 1, 2, 3, 4, 5, 6, 7 + @table: + db 8, 9, 10 + @next: + end ['rax', 'xmm0']; +end. diff --git a/tests/webtbs/tw40113d.pp b/tests/webtbs/tw40113d.pp new file mode 100644 index 0000000000..11840ebdb3 --- /dev/null +++ b/tests/webtbs/tw40113d.pp @@ -0,0 +1,17 @@ +{ %cpu=x86_64 } +{ %opt=-Sew } +{ %norun } + +{$asmmode intel} +begin + asm + movss xmm0, dword ptr [rax-8] // (2) + lea rax, @table[rip] + lea rsp, [rsp+32] + jmp @next + db 0, 1, 2, 3, 4, 5, 6, 7 + @table: + db 8, 9, 10 + @next: + end ['rax', 'xmm0']; +end.