Skip to content

FunC: Built-in functions run_methodX produce stack underflow errors and inconsistent results #1883

@jeshecdom

Description

@jeshecdom

The following code produces a stack underflow when run_method3 executes:

() test(int a, int b, int c) impure method_id(16384) {
   ~dump(a);
   ~dump(b); 
   ~dump(c);
}

() recv_internal() impure {
      run_method3(16384, 100, 200, 300);
}

The expected behavior is that test function prints 100, 200, and 300 in the debug logs when run_method3 executes.

Mysteriously enough, removing argument c from test and changing the method id to 16383:

() test(int a, int b) impure method_id(16383) {
   ~dump(a);
   ~dump(b); 
}

() recv_internal() impure {
      run_method3(16383, 100, 200, 300);
}

Prints 300 and 16383 in the debug log. But, if we change back the method id to 16384:

() test(int a, int b) impure method_id(16384) {
   ~dump(a);
   ~dump(b); 
}

() recv_internal() impure {
      run_method3(16384, 100, 200, 300);
}

It will now print 200 and 300.

The functions run_method0, run_method1, and run_method2 have similar problems with stack underflow and method ids 16383 and 16384.

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