tebe6502 / Mad-Pascal

Mad Pascal Compiler for 6502 (Atari XE/XL, C64, C4Plus, Neo6502)
122 stars 20 forks source link

Unable to pass fields of record as variable for record given by pointer #94

Closed SignumTemporis closed 2 years ago

SignumTemporis commented 2 years ago

Issue description

An attempt to pass fields of a record as variables to a procedure for a record given by a pointer yields compilation error of .a65 file. For FPC -MDelphi v3.2.2 it works as expected.

Mad-Pascal Compiler version d7619c5 Mad-Assembler version 40bfd80

See also #90

Code to reproduce the issue

uses crt;

type
  Point = record x, y: Byte end;
  Segment = record a, b: Point end;
  SegmentPtr = ^Segment;

var s: Segment;

procedure PrintPoint(var p: Point);
begin
  WriteLn(p.x, ' ', p.y);
end;

procedure PrintSegment(sp: SegmentPtr);
begin
  PrintPoint(sp^.a);
  PrintPoint(sp^.b);
end;

begin
  s.a.x := 1;  s.a.y := 2;
  s.b.x := 3;  s.b.y := 4;

  PrintSegment(@s);

  ReadKey();
end.

Output

Expected

1 2
3 4

Actual

        mva  :STACKORIGIN,x
test10.a65 (462) ERROR: Unexpected end of line
tebe6502 commented 2 years ago

fixed

SignumTemporis commented 2 years ago

Works for me now.