Compile with gcc oi.c -shared -o liboi.
Run LD_LIBRARY_PATH=$PWD bic -loi -I$PWD
Execute on the REPL:
#include <oi.h>
get_number();
The segmentation fault happens because this specific function tree has ARGS as null (t1 = 0x0000000000000000). However, evalute.c:552 tries to iterate over this tree:
for_each_tree(i, tFN_ARGS(function))
if (is_T_VARIADIC(i)){
is_variadic = true;
break;
}
A quick workaround for this problem was to check if args was set before iterating over it:
if (tFN_ARGS(function)) {
for_each_tree(i, tFN_ARGS(function))
if (is_T_VARIADIC(i)){
is_variadic = true;
break;
}
}
Perhaps a better solution would be to include this check on the definition of for_each_tree?
Thanks for the bug report and tracking down the problem. I've pushed changes that implements your suggestion of not entering the for_each_tree loop if head is null.
Compile with
gcc oi.c -shared -o liboi
. RunLD_LIBRARY_PATH=$PWD bic -loi -I$PWD
Execute on the REPL:
The segmentation fault happens because this specific function tree has ARGS as null (
t1 = 0x0000000000000000
). However, evalute.c:552 tries to iterate over this tree:A quick workaround for this problem was to check if args was set before iterating over it:
Perhaps a better solution would be to include this check on the definition of
for_each_tree
?