Browse Source

* support db $01 db $02

git-svn-id: trunk@1996 -
peter 19 years ago
parent
commit
717c2172eb
3 changed files with 38 additions and 1 deletions
  1. 1 0
      .gitattributes
  2. 17 1
      compiler/i386/ra386int.pas
  3. 20 0
      tests/webtbs/tw4613.pp

+ 1 - 0
.gitattributes

@@ -6626,6 +6626,7 @@ tests/webtbs/tw4540.pp -text svneol=unset#text/plain
 tests/webtbs/tw4557.pp svneol=native#text/plain
 tests/webtbs/tw4566.pp -text svneol=unset#text/plain
 tests/webtbs/tw4599.pp svneol=native#text/plain
+tests/webtbs/tw4613.pp -text svneol=unset#text/plain
 tests/webtbs/tw4616.pp svneol=native#text/plain
 tests/webtbs/ub1873.pp svneol=native#text/plain
 tests/webtbs/ub1883.pp svneol=native#text/plain

+ 17 - 1
compiler/i386/ra386int.pas

@@ -920,6 +920,11 @@ Unit Ra386int;
                 def:=nil;
                 tempstr:=actasmpattern;
                 prevtok:=prevasmtoken;
+                { stop parsing a constant expression if we find an opcode after a
+                  non-operator like "db $66 mov eax,ebx" }
+                if (prevtok in [AS_ID,AS_INTNUM,AS_RPAREN]) and
+                   is_asmopcode(actasmpattern) then
+                  break;
                 consume(AS_ID);
                 if SearchIConstant(tempstr,l) then
                  begin
@@ -1038,6 +1043,10 @@ Unit Ra386int;
                 if (hs<>'') and not(actasmtoken in [AS_MINUS,AS_PLUS,AS_COMMA,AS_SEPARATOR,AS_END,AS_RBRACKET]) then
                  Message(asmr_e_only_add_relocatable_symbol);
               end;
+            AS_ALIGN,
+            AS_DB,
+            AS_DW,
+            AS_DD,
             AS_END,
             AS_RBRACKET,
             AS_SEPARATOR,
@@ -1961,7 +1970,14 @@ Unit Ra386int;
                  ConcatConstant(curlist,value,constsize);
               end;
             AS_COMMA:
-              Consume(AS_COMMA);
+              begin
+                Consume(AS_COMMA);
+              end;
+            AS_ALIGN,
+            AS_DB,
+            AS_DW,
+            AS_DD,
+            AS_OPCODE,
             AS_END,
             AS_SEPARATOR:
               break;

+ 20 - 0
tests/webtbs/tw4613.pp

@@ -0,0 +1,20 @@
+{ %cpu=i386 }
+
+{ Source provided for Free Pascal Bug Report 4613 }
+{ Submitted by "darek" on  2005-12-16 }
+{ e-mail: [email protected] }
+
+{$mode delphi}
+
+procedure p1;
+asm
+   @L1000:
+     //movdqu  xmm0, [eax+ebx]
+     db $F2 mov eax,ebx
+     db $F2 db $0F db $F0 db $04 db $03 //this cause error
+     //movdqa  [edx+ebx], xmm0
+     //movdqu  xmm1, [eax+ebx+16]
+end;
+
+begin
+end.