You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Arithmetic on a pointer passed by variable modifies the data it refers to while it should effect the pointer itself.
For FPC -MDelphi v3.2.2 it works as expected.
Mad-Pascal Compiler version 9cc0813
Mad-Assembler version 40bfd80
Code to reproduce the issue
uses crt;
type BytePtr = ^Byte;
var
data: array [0 .. 1] of Byte;
p: BytePtr;
procedureDoSomething(var p2: Pointer);
begin
p2 := p2 + 1;
end;
begin
data[0] := 10; data[1] := 20;
p := @data;
Write(p^);
DoSomething(p);
WriteLn('', p^);
ReadKey();
end.
Output
Expected
10 20
Actual
10 11
The text was updated successfully, but these errors were encountered:
SignumTemporis
changed the title
Operation on pointer passed by variable should not affect data
Arithmetic on pointer passed by variable should not affect data
Apr 28, 2022
Issue description
Arithmetic on a pointer passed by variable modifies the data it refers to while it should effect the pointer itself.
For FPC -MDelphi v3.2.2 it works as expected.
Mad-Pascal Compiler version 9cc0813
Mad-Assembler version 40bfd80
Code to reproduce the issue
Output
Expected
Actual
The text was updated successfully, but these errors were encountered: