Browse Source

* support LOC_(C)SUBSETREG in tcgvecnode.pass_generate_code, can also occur
for function results (patch by Do-wan Kim, mantis #29064)

git-svn-id: trunk@32516 -

Jonas Maebe 9 years ago
parent
commit
9dc5f1acb4
3 changed files with 49 additions and 0 deletions
  1. 1 0
      .gitattributes
  2. 2 0
      compiler/ncgmem.pas
  3. 46 0
      tests/webtbs/tw29064.pp

+ 1 - 0
.gitattributes

@@ -14879,6 +14879,7 @@ tests/webtbs/tw2904.pp svneol=native#text/plain
 tests/webtbs/tw29040.pp svneol=native#text/plain
 tests/webtbs/tw29040.pp svneol=native#text/plain
 tests/webtbs/tw29053.pp svneol=native#text/pascal
 tests/webtbs/tw29053.pp svneol=native#text/pascal
 tests/webtbs/tw29053b.pp svneol=native#text/pascal
 tests/webtbs/tw29053b.pp svneol=native#text/pascal
+tests/webtbs/tw29064.pp svneol=native#text/plain
 tests/webtbs/tw2908.pp svneol=native#text/plain
 tests/webtbs/tw2908.pp svneol=native#text/plain
 tests/webtbs/tw2911.pp svneol=native#text/plain
 tests/webtbs/tw2911.pp svneol=native#text/plain
 tests/webtbs/tw2912.pp svneol=native#text/plain
 tests/webtbs/tw2912.pp svneol=native#text/plain

+ 2 - 0
compiler/ncgmem.pas

@@ -963,8 +963,10 @@ implementation
            begin
            begin
               { may happen in case of function results }
               { may happen in case of function results }
               case left.location.loc of
               case left.location.loc of
+                LOC_CSUBSETREG,
                 LOC_CREGISTER,
                 LOC_CREGISTER,
                 LOC_CMMREGISTER,
                 LOC_CMMREGISTER,
+                LOC_SUBSETREG,
                 LOC_REGISTER,
                 LOC_REGISTER,
                 LOC_MMREGISTER:
                 LOC_MMREGISTER:
                   hlcg.location_force_mem(current_asmdata.CurrAsmList,left.location,left.resultdef);
                   hlcg.location_force_mem(current_asmdata.CurrAsmList,left.location,left.resultdef);

+ 46 - 0
tests/webtbs/tw29064.pp

@@ -0,0 +1,46 @@
+program ie200411013;
+
+{$mode objfpc}{$H+}
+
+uses
+  ctypes;
+
+type
+  in_addr = record
+    s_bytes : array[1..4] of byte;
+  end;
+
+  sockaddr = record
+    sin_family: word;
+    sin_port: word;
+    sin_addr: in_addr;
+  end;
+  TSockAddr = sockaddr;
+
+  { TSocketStream }
+
+  TSocketStream = class
+  private
+    function GetRemoteAddress: TSockAddr;
+  Public
+    property RemoteAddress: TSockAddr read GetRemoteAddress;
+  end;
+
+function TSocketStream.GetRemoteAddress: TSockAddr;
+var
+  sa: sockaddr;
+begin
+  sa.sin_addr.s_bytes[2]:=4;
+  result:=sa;
+end;
+
+var
+  ss: TSocketStream;
+  b: byte;
+begin
+  ss:=TSocketStream.create;
+  b := ss.RemoteAddress.sin_addr.s_bytes[2];
+  if b<>4 then
+    halt(1);
+end.
+