Require Word as array index #127

Open
opened 2025-07-13 18:37:58 +02:00 by belka · 0 comments
Owner

The following program exits with status 1 (as expected):

program;

proc f() -> Char;
var
  a: [10]Char;
begin
  a[1u] := '0';
  return a[1u]
end;

proc exit(code: Int); extern;

begin
  if f() = '0' then
    exit(1)
  else
    exit(2)
  end
end.

But change a[1u] := '0'; to a[1] := '0'; to the exit status changes to 2. Why?

The following program exits with status `1` (as expected): ``` program; proc f() -> Char; var a: [10]Char; begin a[1u] := '0'; return a[1u] end; proc exit(code: Int); extern; begin if f() = '0' then exit(1) else exit(2) end end. ``` But change `a[1u] := '0';` to `a[1] := '0';` to the exit status changes to `2`. Why?
belka added the
bootstrap
label 2025-07-13 18:37:58 +02:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: belka/elna#127
No description provided.