Segmentation fault on Windows with {|CONS of {..}|} instead of {|CONS of d|} for module-internal generic

In https://gitlab.science.ru.nl/clean-and-itasks/abc-interpreter/issues/78 it turned out that the Windows version of the ABC interpreter crashed under some circumstances. The fix (https://gitlab.science.ru.nl/clean-and-itasks/abc-interpreter/commit/52af2ac14d78a44bd2af77f354ee694d2b933d99) was to change the type of a generic function from {|CONS of {gcd_name,gcd_arity}|} to {|CONS of d=:{gcd_name,gcd_arity}|} (without using d in the body). This should of course not make a difference in behaviour.

I'm attaching the source code which contains the bug; my workaround with d=: can be applied in src/ABC/Parse.icl. To reproduce the bug, build the project, and run ABCOptimiser.exe test.abc -o test.opt.abc.

When generic fusion is turned off the bug does not appear, so perhaps the d=: trick only increases the arity so that the bug is avoided by the arity<32 check.

This bug is present on the latest x64 Windows build (May 14), but I have not been able to reproduce it on Linux.

src.tar.gz

Edited by Ghost User