zserge / partcl

ParTcl - a micro Tcl implementation
https://zserge.com/posts/tcl-interpreter/
MIT License
470 stars 50 forks source link

Program received signal SIGSEGV, Segmentation fault #6

Open pointhi opened 6 years ago

pointhi commented 6 years ago

I found a code snippet which results in a segfault of the interpreter

#define TEST
#include "tcl.c"

#define TCL_BENCH "set i 0; while {< $i 1} {if {== [- $i] -1} {} {set i [+ $i 1]}}"

int main() {
    struct tcl tcl;
    tcl_init(&tcl);

    tcl_eval(&tcl, TCL_BENCH, sizeof(TCL_BENCH));

    tcl_destroy(&tcl);

    return 0;
}