Browse Source

* allow call dword ptr eax in delphi, resolves #18225

git-svn-id: trunk@35572 -
florian 8 years ago
parent
commit
ad557a1da6
4 changed files with 26 additions and 1 deletions
  1. 2 0
      .gitattributes
  2. 4 1
      compiler/x86/rax86int.pas
  3. 10 0
      tests/webtbf/tw18225b.pp
  4. 10 0
      tests/webtbs/tw18225.pp

+ 2 - 0
.gitattributes

@@ -13706,6 +13706,7 @@ tests/webtbf/tw18058b.pp svneol=native#text/plain
 tests/webtbf/tw18058c.pp svneol=native#text/plain
 tests/webtbf/tw18096.pp svneol=native#text/pascal
 tests/webtbf/tw18096c.pp svneol=native#text/pascal
+tests/webtbf/tw18225b.pp svneol=native#text/pascal
 tests/webtbf/tw18267.pp svneol=native#text/plain
 tests/webtbf/tw1827.pp svneol=native#text/plain
 tests/webtbf/tw1830.pp svneol=native#text/plain
@@ -14619,6 +14620,7 @@ tests/webtbs/tw18127.pp svneol=native#text/pascal
 tests/webtbs/tw18131.pp svneol=native#text/pascal
 tests/webtbs/tw1820.pp svneol=native#text/plain
 tests/webtbs/tw18222.pp svneol=native#text/pascal
+tests/webtbs/tw18225.pp svneol=native#text/pascal
 tests/webtbs/tw1825.pp svneol=native#text/plain
 tests/webtbs/tw18266.pp svneol=native#text/plain
 tests/webtbs/tw18334.pp svneol=native#text/plain

+ 4 - 1
compiler/x86/rax86int.pas

@@ -1842,7 +1842,10 @@ Unit Rax86int;
                       Message(asmr_e_syn_operand);
                   end;
                 Consume(AS_PTR);
-                oper.InitRef;
+                { in delphi mode, allow e.g. call dword ptr eax,
+                  see also webtbs/tw18225.pp }
+                if not(m_delphi in current_settings.modeswitches) then
+                  oper.InitRef;
                 { if the operand subscripts a record, the typesize will be
                   rest -> save it here and restore it afterwards }
                 l:=oper.typesize;

+ 10 - 0
tests/webtbf/tw18225b.pp

@@ -0,0 +1,10 @@
+{ %fail }
+{ %cpu=i386,x86_64 }
+{$asmmode intel}
+procedure CallProc(p: pointer); assembler;
+asm
+          call dword ptr p
+          call dword ptr CallProc
+end; { CallProc }
+begin
+end.

+ 10 - 0
tests/webtbs/tw18225.pp

@@ -0,0 +1,10 @@
+{ %cpu=i386,x86_64 }
+{$mode delphi}
+{$asmmode intel}
+procedure CallProc(p: pointer); assembler;
+asm
+          call dword ptr p
+          call dword ptr CallProc
+end; { CallProc }
+begin
+end.