ソースを参照

* handle variables without explicit size prefix better in inline assembler, resolves #18009

git-svn-id: trunk@16859 -
florian 14 年 前
コミット
e7fa076b70

+ 1 - 0
.gitattributes

@@ -10941,6 +10941,7 @@ tests/webtbs/tw17957.pp svneol=native#text/pascal
 tests/webtbs/tw1798.pp svneol=native#text/plain
 tests/webtbs/tw17986.pp svneol=native#text/pascal
 tests/webtbs/tw17998.pp svneol=native#text/plain
+tests/webtbs/tw18009.pp svneol=native#text/pascal
 tests/webtbs/tw18013.pp svneol=native#text/plain
 tests/webtbs/tw18075.pp svneol=native#text/pascal
 tests/webtbs/tw18082.pp svneol=native#text/plain

+ 2 - 3
compiler/i386/ag386nsm.pas

@@ -391,8 +391,7 @@ interface
                   if o.ref^.offset>0 then
                    asmwrite('+');
                   asmwrite(tostr(o.ref^.offset));
-
-                  end;
+                end;
             end;
           else
             internalerror(10001);
@@ -1183,7 +1182,7 @@ interface
             labelprefix : '..@';
             comment : '; ';
           );
-          
+
        as_i386_nasmhaiku_info : tasminfo =
           (
             id           : as_i386_nasmhaiku;

+ 6 - 1
compiler/x86/rax86.pas

@@ -204,6 +204,11 @@ begin
         OS_32 : opsize:=S_IL;
         OS_64 : opsize:=S_IQ;
       end;
+    end
+  else
+    begin
+      if size=OS_64 then
+        opsize:=S_Q;
     end;
 end;
 
@@ -233,7 +238,7 @@ begin
          not(opr.ref.refaddr in [addr_pic,addr_pic_no_got]) then
         begin
           if (opr.ref.symbol.name <> '_GLOBAL_OFFSET_TABLE_') then
-            begin 
+            begin
               message(asmr_e_need_pic_ref);
               result:=false;
             end

+ 8 - 1
compiler/x86/rax86int.pas

@@ -1768,7 +1768,14 @@ Unit Rax86int;
                                 Message1(sym_e_unknown_id,expr);
                               expr:='';
                             end;
-                         end;
+                          { indexed access to variable? }
+                          if actasmtoken=AS_LBRACKET then
+                            begin
+                              { ... then the operand size is not known anymore }
+                              oper.size:=OS_NO;
+                              BuildReference(oper);
+                            end;
+                        end;
                      end;
                  end;
               end;

+ 19 - 0
tests/webtbs/tw18009.pp

@@ -0,0 +1,19 @@
+{ %CPU=i386 }
+{ %TARGET=go32v2,win32,linux }
+{ %NOTE=This test requires an installed Nasm }
+
+{$ASMMODE INTEL}
+var
+q:qword;
+
+begin
+asm
+  paddb mm0,q
+  paddw mm0,q
+  paddd mm0,q
+  paddusb mm0,q
+  paddusw mm0,q
+  paddsb mm0,q
+  paddsw mm0,q
+end;
+end.