* if a pointer_to_array type conversion is applied to a variable, it is not written, resolves #39957

This commit is contained in:
florian 2022-10-14 23:11:08 +02:00
parent 27315ac528
commit 1c86a4bbeb
2 changed files with 11 additions and 1 deletions

View File

@ -3775,7 +3775,8 @@ implementation
procedure Ttypeconvnode.mark_write;
begin
left.mark_write;
if not(convtype=tc_pointer_2_array) then
left.mark_write;
end;
function ttypeconvnode.first_cord_to_pointer : tnode;

9
tests/webtbs/tw39957.pp Normal file
View File

@ -0,0 +1,9 @@
{ %opt=-O4 -Oodeadstore -Oonoregvar }
var
src: array[0 .. 9] of int32;
srcp: pInt32;
begin
srcp := pInt32(src);
srcp[0] := 1;
end.