Skip to content

Using same name for procedure and its argument leads to wrong code #9

@wipe2238

Description

@wipe2238
procedure stuff(variable stuff, variable in_recursion := 0)
begin
  if not(in_recursion) then
   stuff := stuff(stuff, 1);
  else
  begin
     display_msg("doing critical stuff");
     stuff++;
     return stuff;
  end
end

procedure start begin call stuff(0); end

According to int2sll it compiles to

procedure stuff(variable arg0, variable arg1);
procedure start;

procedure stuff(variable arg0, variable arg1)
begin
    if (not(arg1)) then begin
        arg0 := arg0(arg0, 1); // wait what...
    end
    else begin
        display_msg("doing critical stuff");
        arg0 := arg0 + 1;
        return arg0;
    end
end

procedure start
begin
    call stuff(0, 0);
end

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions