2
0
Эх сурвалжийг харах

* avoid internal error if an empty record is assigned to a function result, resolves #25895

git-svn-id: trunk@27223 -
florian 11 жил өмнө
parent
commit
6f14dbdebe

+ 1 - 0
.gitattributes

@@ -13847,6 +13847,7 @@ tests/webtbs/tw25814.pp svneol=native#text/plain
 tests/webtbs/tw25869.pp svneol=native#text/plain
 tests/webtbs/tw2588.pp svneol=native#text/plain
 tests/webtbs/tw2589.pp svneol=native#text/plain
+tests/webtbs/tw25895.pp svneol=native#text/pascal
 tests/webtbs/tw2594.pp svneol=native#text/plain
 tests/webtbs/tw2595.pp svneol=native#text/plain
 tests/webtbs/tw2602.pp svneol=native#text/plain

+ 4 - 0
compiler/hlcg2ll.pas

@@ -1428,6 +1428,10 @@ implementation
     var
       tmploc: tlocation;
     begin
+      { skip e.g. empty records }
+      if (cgpara.location^.loc = LOC_VOID) then
+        exit;
+
       { Handle Floating point types differently
 
         This doesn't depend on emulator settings, emulator settings should

+ 14 - 0
tests/webtbs/tw25895.pp

@@ -0,0 +1,14 @@
+{$MODE OBJFPC}
+program test;
+
+type
+   TDummy = record end;
+
+function Foo(): TDummy;
+begin
+   Result := Default(TDummy);
+end; // Fatal: Internal error 2010053111
+
+begin
+   Foo();
+end.