Bläddra i källkod

* strange oversight fixed that tcgassignmentnode.pass_generate_code doesn't handle a certain
combination of locations, resolves #41366

florian 3 veckor sedan
förälder
incheckning
38fd88f001
2 ändrade filer med 23 tillägg och 0 borttagningar
  1. 1 0
      compiler/ncgld.pas
  2. 22 0
      tests/webtbs/tw41366.pp

+ 1 - 0
compiler/ncgld.pas

@@ -1190,6 +1190,7 @@ implementation
                               cg.g_flags2reg(current_asmdata.CurrAsmList,left.location.size,right.location.resflags,left.location.register);
                               cg.a_reg_dealloc(current_asmdata.CurrAsmList,NR_DEFAULTFLAGS);
                             end;
+                        LOC_CREFERENCE,
                         LOC_REFERENCE:
                         { i8086 and i386 have hacks in their code generators so that they can
                           deal with 64 bit locations in this parcticular case }

+ 22 - 0
tests/webtbs/tw41366.pp

@@ -0,0 +1,22 @@
+unit tw41366;
+
+{$mode objfpc}
+
+interface
+
+type
+  TItem = record
+    Flag: Boolean;
+  end;
+  TItemArray = array of TItem;
+
+procedure Foo(const Items: TItemArray);
+
+implementation
+
+procedure Foo(const Items: TItemArray);
+begin
+  Items[0].Flag := (@Items <> Nil);
+end;
+
+end.