Ver código fonte

+ ensure the callee size paraloc info is available, when setting up a local var
or parameter in RAUtils.TOperand.SetupVar(). This fixes a compiler crash, when
a parent parameter or local var is accessed (in certain ways) inside a nested
inline asm routine.

git-svn-id: trunk@38236 -

nickysn 7 anos atrás
pai
commit
b9e41330d4
3 arquivos alterados com 34 adições e 0 exclusões
  1. 1 0
      .gitattributes
  2. 12 0
      compiler/rautils.pas
  3. 21 0
      tests/test/tasm19.pp

+ 1 - 0
.gitattributes

@@ -12510,6 +12510,7 @@ tests/test/tasm18e.pp svneol=native#text/plain
 tests/test/tasm18f.pp svneol=native#text/plain
 tests/test/tasm18g.pp svneol=native#text/plain
 tests/test/tasm18h.pp svneol=native#text/plain
+tests/test/tasm19.pp svneol=native#text/plain
 tests/test/tasm2.inc svneol=native#text/plain
 tests/test/tasm2.pp svneol=native#text/plain
 tests/test/tasm2a.pp svneol=native#text/plain

+ 12 - 0
compiler/rautils.pas

@@ -816,6 +816,7 @@ var
     (e.g. var tralala: word absolute moo[5]; ) }
   absoffset: asizeint=0;
   harrdef: tarraydef;
+  tmpprocinfo: tprocinfo;
 Begin
   SetupVar:=false;
   asmsearchsym(s,sym,srsymtable);
@@ -928,6 +929,17 @@ Begin
           paravarsym,
           localvarsym :
             begin
+              tmpprocinfo:=current_procinfo;
+              while assigned(tmpprocinfo) do
+                begin
+                  if (sym.owner=tmpprocinfo.procdef.localst) or
+                     (sym.owner=tmpprocinfo.procdef.parast) then
+                    begin
+                      tmpprocinfo.procdef.init_paraloc_info(calleeside);
+                      break;
+                    end;
+                  tmpprocinfo:=tmpprocinfo.parent;
+                end;
               if opr.typ=OPR_REFERENCE then
                 begin
                   indexreg:=opr.ref.base;

+ 21 - 0
tests/test/tasm19.pp

@@ -0,0 +1,21 @@
+{ %NORUN }
+{ %CPU=i8086 }
+
+{$IFDEF FPC}
+{$MODE TP}
+{$ENDIF}
+program tasm19;
+
+procedure subpcrash(x: word);
+
+  procedure subtocrash; assembler;
+  asm
+    { compiler crash here... }
+    mov ax,[si+offset x]
+  end;
+
+begin
+end;
+
+begin
+end.