It takes about 3 days's worth of work to produce a test case like this. Is there a better option than deleting a piece of code and then recompiling? I essentially have to "unwrite" my whole program. Is there a fuzzer-like tool that could conceivably be used?
Both are merged to the 7.10 branch and so will appear in 7.10.2.
It would be good if you were able to test that the 7.10 branch is indeed fixed in your case. I will try to do the same.
Simon
PS: for "entered absent arg w_sJ66e" bugs, compile with "-ddump-simpl" and grep for that string. That will show exactly which thunk in which function is being entered, and might save time compared to delete/recompile.
Oh VERY interesting! I have reproduced the problem with 7.10, and it is YET ANOTHER bug in the demand analyser. Here is the offending code
dmdAnal' sigs dmd (App fun (Coercion co)) = (fun_ty, App fun' (Coercion co)) where (fun_ty, fun') = dmdAnal sigs dmd fun
The incoming demand dmd is not modified before passing it on to fun.
But that is wrong wrong wrong. That gets the demands from the function out of step, so the wrong demand goes to the wrong argument. It's a miracle that this has not been causing chaos for ages. Horror. Coercions are value arguments and so they must be treated as such.
I think the solution is simply to delete these lines so that coercion arguments are handled uniformly; but I want to tread carefully.
yongqli, your test case nailed it -- thank you! It was so helpful to be able to reproduce it, and it's not an easy case to make happen, so I might well have failed to find it, or assumed it was already fixed, without your help.
Austin: please merge the above two to 7.10.
I'm not adding a regression test because it's hard to provoke; and the fix (which consisted only of deleting code) is pretty robust.