Browse Source

* treat typecast(register) the same as typecast([register]) in assembler
expressions (for Delphi compatibility, mantis #9327)

git-svn-id: trunk@13040 -

Jonas Maebe 16 years ago
parent
commit
ca132e203f
3 changed files with 29 additions and 0 deletions
  1. 1 0
      .gitattributes
  2. 5 0
      compiler/x86/rax86int.pas
  3. 23 0
      tests/webtbs/tw9327.pp

+ 1 - 0
.gitattributes

@@ -9678,6 +9678,7 @@ tests/webtbs/tw9299.pp -text
 tests/webtbs/tw9306a.pp -text
 tests/webtbs/tw9306b.pp -text
 tests/webtbs/tw9309.pp -text
+tests/webtbs/tw9327.pp svneol=native#text/plain
 tests/webtbs/tw9347.pp svneol=native#text/plain
 tests/webtbs/tw9347a.pp svneol=native#text/plain
 tests/webtbs/tw9347b.pp svneol=native#text/plain

+ 5 - 0
compiler/x86/rax86int.pas

@@ -1718,6 +1718,11 @@ Unit Rax86int;
                                 { Support Type([Reference]) }
                                 Consume(AS_LPAREN);
                                 BuildOperand(oper,true);
+                                { Delphi also supports Type(Register) and
+                                  interprets it the same as Type([Register]).  }
+                                if (oper.opr.typ = OPR_REGISTER) then
+                                  { This also sets base to the register.  }
+                                  oper.InitRef;
                                 Consume(AS_RPAREN);
                               end;
                             AS_LBRACKET :

+ 23 - 0
tests/webtbs/tw9327.pp

@@ -0,0 +1,23 @@
+{% opt=-Cg- }
+{% cpu=i386 }
+
+program fpcbug;
+
+{$asmmode intel}
+
+type
+  TBla = record
+    Bla: Cardinal;
+  end;
+
+var
+  b: tbla;
+begin
+  asm
+    lea edi, b
+    mov eax, $12345678
+    mov TBla(edi).&Bla, eax
+  end;
+  if b.bla<>$12345678 then
+    halt(1);
+end.