瀏覽代碼

* allow also CSUBSETREG in tx86inlinenode.second_IncludeExclude, resolves #38733

git-svn-id: trunk@49151 -
florian 4 年之前
父節點
當前提交
b09669dffe
共有 3 個文件被更改,包括 41 次插入1 次删除
  1. 1 0
      .gitattributes
  2. 2 1
      compiler/x86/nx86inl.pas
  3. 38 0
      tests/webtbs/tw38733.pp

+ 1 - 0
.gitattributes

@@ -18775,6 +18775,7 @@ tests/webtbs/tw3865.pp svneol=native#text/plain
 tests/webtbs/tw38695.pp svneol=native#text/pascal
 tests/webtbs/tw3870.pp svneol=native#text/plain
 tests/webtbs/tw38703.pp svneol=native#text/pascal
+tests/webtbs/tw38733.pp svneol=native#text/pascal
 tests/webtbs/tw3893.pp svneol=native#text/plain
 tests/webtbs/tw3898.pp svneol=native#text/plain
 tests/webtbs/tw3899.pp svneol=native#text/plain

+ 2 - 1
compiler/x86/nx86inl.pas

@@ -1075,8 +1075,9 @@ implementation
                       ((tcallparanode(tcallparanode(left).right).left.location.value-setbase) div bitsperop)*tcgsize2size[opsize]);
                     cg.a_op_const_ref(current_asmdata.CurrAsmList,cgop,opsize,l,tcallparanode(left).left.location.reference);
                   end;
+                LOC_CSUBSETREG,
                 LOC_CREGISTER :
-                  cg.a_op_const_reg(current_asmdata.CurrAsmList,cgop,tcallparanode(left).left.location.size,l,tcallparanode(left).left.location.register);
+                  hlcg.a_op_const_loc(current_asmdata.CurrAsmList,cgop,tcallparanode(left).left.resultdef,l,tcallparanode(left).left.location);
                 else
                   internalerror(200405022);
               end;

+ 38 - 0
tests/webtbs/tw38733.pp

@@ -0,0 +1,38 @@
+type
+       TSimpleEnum = (seOne, seTwo);
+       TSimpleSet = set of TSimpleEnum;
+
+       TRecordWithSet = record
+               TheSet  :       TSimpleSet;
+       end;
+
+function FirstFunc:TRecordWithSet;
+begin
+       FirstFunc.TheSet := [];
+
+       //below would work fine
+       //FirstFunc.TheSet := FirstFunc.TheSet + [seOne];
+
+       //below line causes error "Fatal: Internal error 200405022"
+       Include(FirstFunc.TheSet, seOne);
+	   if not(seOne in FirstFunc.TheSet) then
+	     halt(1);
+end;
+
+//absolute variable overlaying Result doesn't help
+function SecondFunc:TRecordWithSet;
+var
+       LocalAbs        : TRecordWithSet absolute SecondFunc;
+begin
+       LocalAbs.TheSet := [];
+       //below line would cause same error
+       Include(LocalAbs.TheSet, seOne);
+	   if not(seOne in LocalAbs.TheSet) then
+	     halt(1);
+end;
+
+var
+       Collected       : TRecordWithSet;
+begin
+       Collected := FirstFunc;
+end.