diff --git a/.gitattributes b/.gitattributes index 807a80083a..0347e33c74 100644 --- a/.gitattributes +++ b/.gitattributes @@ -13923,6 +13923,7 @@ tests/webtbs/tw2300.pp svneol=native#text/plain tests/webtbs/tw2305.pp svneol=native#text/plain tests/webtbs/tw2306.pp svneol=native#text/plain tests/webtbs/tw2307.pp svneol=native#text/plain +tests/webtbs/tw23109.pp svneol=native#text/plain tests/webtbs/tw2311.pp svneol=native#text/plain tests/webtbs/tw23130.pp svneol=native#text/pascal tests/webtbs/tw23136.pp svneol=native#text/pascal diff --git a/compiler/x86/rax86.pas b/compiler/x86/rax86.pas index 391ed7ad05..24ad962395 100644 --- a/compiler/x86/rax86.pas +++ b/compiler/x86/rax86.pas @@ -437,7 +437,11 @@ begin memopsize := 0; case operands[i].opr.typ of OPR_LOCAL: memopsize := operands[i].opr.localvarsize * 8; - OPR_REFERENCE: memopsize := operands[i].opr.varsize * 8; + OPR_REFERENCE: + if operands[i].opr.ref.refaddr = addr_pic then + memopsize := sizeof(pint) * 8 + else + memopsize := operands[i].opr.varsize * 8; end; if memopsize = 0 then memopsize := topsize2memsize[tx86operand(operands[i]).opsize]; diff --git a/tests/webtbs/tw23109.pp b/tests/webtbs/tw23109.pp new file mode 100644 index 0000000000..385c87b0a1 --- /dev/null +++ b/tests/webtbs/tw23109.pp @@ -0,0 +1,13 @@ +{ %cpu=x86_64} +{ %opt=-Cg -vew } + +var + global: boolean; +begin + asm + movq global@GOTPCREL(%rip), %rax + movb $1, (%rax) + end; + if not global then + halt(1); +end.