Hello,
the attached ML file causes Poly/ML 4.1.3 to crash with a segmentation fault under Linux version 2.4.21-243-smp4G. Any help would be greatly appreciated.
Greetings, Stefan
Stefan Berghofer wrote:
Hello,
the attached ML file causes Poly/ML 4.1.3 to crash with a segmentation fault under Linux version 2.4.21-243-smp4G. Any help would be greatly appreciated.
The bug seems to be in the implementation of the equality operator. I managed to come up with a smaller example: If you define
datatype ('a, 'v) trie = Trie of 'v option * ('a * ('a, 'v) trie) list;
val x = Trie (NONE, [(0, Trie (SOME ~2, []))]);
val y = Trie (NONE, [(~2, Trie (NONE, [(0, Trie (SOME 1, [])), (0, Trie (NONE, []))])), (0, Trie (SOME ~2, [(0, Trie (SOME 2, [])), (1, Trie (SOME ~1, []))]))]);
then the comparison
x = y
causes a segmentation fault with PolyML 4.1.3 (both under Linux and Solaris). With PolyML 4.1, 4.1.1, and 4.1.2 the above comparison leads to the error message
Exception- InternalError: outer level reached in lookupOldAddr raised while compiling
whereas with PolyML 4.0, the comparison still evaluates correctly to false.
Greetings, Stefan
Stefan Berghofer wrote:
the attached ML file causes Poly/ML 4.1.3 to crash with a segmentation fault under Linux version 2.4.21-243-smp4G. Any help would be greatly appreciated.
The bug seems to be in the implementation of the equality operator.
Thanks for reporting this and narrowing it down to something manageable. It turned out to be a bug in the equality compiler in 4.1.3 which was generating bad code. I'm not sure what the errors in the earlier versions were. I've fixed the bug in the development sources http://www.polyml.org/polyml-devel.tar.gz and this will be included in the next release. If you're not happy about rebuilding from source it is possible to work around the bug. The code below doesn't seem to crash. Regards, David.
datatype ('a, 'v) trie = Trie of 'v option * (('a, 'v) trie') list and ('a, 'v) trie' = Trie' of ('a * ('a, 'v) trie);
val x = Trie (NONE, [Trie' (0, Trie (SOME ~2, []))]);
val y = Trie (NONE, [Trie'(~2, Trie (NONE, [Trie'(0, Trie (SOME 1, [])), Trie'(0, Trie (NONE, []))])), Trie'(0, Trie (SOME ~2, [Trie'(0, Trie (SOME 2, [])), Trie'(1, Trie (SOME ~1, []))]))]);
x = y ;