Status code returns as 0 locally but returns as -1 on the remote tester

i am getting a status code return as 0 locally but -1 on the remote tester as shown on the image.

my github repo link is GitHub - abdelshafei/CodeInterpreter: Custom programming language interpreter

Thanks for your post! I’ll take a look and get back to you by the end of the week.

I had something similar happen… and I did not understand why it didn’t work until I threw my program at valgrind and then I realized my code read memory that was NOT allocated.

The runner failing with exit code -1 without any feedback is a problem though.
Anyways, those runners are super strict about memory management.

Those are guesses of what would cause your program to exit with code -1:

  • A double free
  • Use after free
  • Any read before or beyond an allocated block of memory
  • Dereferencing nullptr (obviously)

After changing the content of test.lox to print false; like the runner did and running your code under valgrind, we can see where the issue comes from:


In this case, we have a use after free (the parser’s destructor tries to access an allocation that was already freed prior).

nvm. was able to fix it by dynamically allocating the vector of statements instead of doing so statically. thanks for the help!