From d8aa721f88d8139d6e233a209286c03ed87ea6a9 Mon Sep 17 00:00:00 2001 From: Sven/Sarah Barth Date: Fri, 8 Apr 2022 16:11:49 +0200 Subject: [PATCH] * free the placeholder for the count of the dynamic array in end_dynarray_const() and document it as such (cherry picked from commit 1180589046372dfb838bd87ce3f48b698853641f) --- compiler/aasmcnst.pas | 2 ++ 1 file changed, 2 insertions(+) diff --git a/compiler/aasmcnst.pas b/compiler/aasmcnst.pas index 8c2b8fdea4..6a8b0b900f 100644 --- a/compiler/aasmcnst.pas +++ b/compiler/aasmcnst.pas @@ -352,6 +352,7 @@ type procedure emit_dynarray_offset(const ll:tasmlabofs;const arrlength:asizeint;const arrdef:tdef);virtual; { starts a dynamic array constant so that its data can be emitted directly afterwards } function begin_dynarray_const(arrdef:tdef;var startlab:tasmlabel;out arrlengthloc:ttypedconstplaceholder):tasmlabofs;virtual; + { ends a dynamic array constant by updating the count field; the arrlengthloc will be freed } function end_dynarray_const(arrdef:tdef;arrlength:asizeint;arrlengthloc:ttypedconstplaceholder):tdef;virtual; { emit a shortstring constant, and return its def } @@ -1761,6 +1762,7 @@ implementation begin { we emit the high value, not the count } arrlengthloc.replace(tai_const.Create_sizeint(arrlength-1),sizesinttype); + arrlengthloc.free; result:=end_anonymous_record; end;