Selaa lähdekoodia

* handle also LOC_CREGISTER/LOC_CMMREGISTER in tcgvecnode.pass_generate_code, resolves #24705

git-svn-id: trunk@25039 -
florian 12 vuotta sitten
vanhempi
commit
963a488ca2
3 muutettua tiedostoa jossa 29 lisäystä ja 0 poistoa
  1. 1 0
      .gitattributes
  2. 2 0
      compiler/ncgmem.pas
  3. 26 0
      tests/webtbs/tw24705.pp

+ 1 - 0
.gitattributes

@@ -13454,6 +13454,7 @@ tests/webtbs/tw2438.pp svneol=native#text/plain
 tests/webtbs/tw2442.pp svneol=native#text/plain
 tests/webtbs/tw2452.pp svneol=native#text/plain
 tests/webtbs/tw2454.pp svneol=native#text/plain
+tests/webtbs/tw24705.pp svneol=native#text/pascal
 tests/webtbs/tw2473.pp svneol=native#text/plain
 tests/webtbs/tw2480.pp svneol=native#text/plain
 tests/webtbs/tw2481.pp svneol=native#text/plain

+ 2 - 0
compiler/ncgmem.pas

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

+ 26 - 0
tests/webtbs/tw24705.pp

@@ -0,0 +1,26 @@
+{ %OPT=-O2 }
+{$ifdef fpc}
+  {$mode objfpc}
+{$endif}
+
+{$apptype console}
+
+type
+    TTest = record
+        x: byte;
+    end;
+
+    TByte = array [ 0 .. 0 ] of byte;
+
+function test( dummy: integer ): TTest;
+begin
+    result.x := dummy;
+    TByte( result.x )[0] := result.x;
+end;
+
+begin
+    if test( $5A ).x = $5A then
+        writeln( 'pass' )
+    else
+        halt( 1 );
+end.