Crash with typeclasses when using unique modes on tuples
AlaskanEmily opened this issue · 4 comments
I've reduced the testcase somewhat, although it might not be fully optimal yet:
https://osdn.net/users/alaskanemily/pastebin/7188?action=raw
The use of typeclasses is required to trigger the crash. I'm not 100% sure that the tuples are needed to trigger it, but messing with that too much seemed to fix the crash too.
I tested with rotd-2021-06-28 on OpenBSD 6.9, AMD64. It seemed to occur with all grades (at least hlc.gc and asm_fast.gc) and with or without optimizations.
I have diagnosed the problem (or at least a problem): it is the polymorphism pass's mishandling
of nonlocal typeclass_info variables. The presence of tuples does not seem to factor into it.
I am looking into a possible solution.
I just committed a diff that fixes this test case, and should fix whatever original source
you cut it down from. Please report whether it does nor not.
The fix should be in the next rotd.
I also added generate_foldl2 to the array module, which should avoid the need to use tuples
in this code.
Hmm, one thing I saw building the latest ROTD is that library/table_statistics.m
has an error about duplicate/redundant :- pragma foreign_import_module
declarations. If I just comment out the one on like 167 it seems to build fine.
Yep, I tested with rotd-2021-08-21
and the crash no longer occurs.
I actually encountered a second case of the crash after working around the first, and it was also fixed by this.