<div dir="ltr">Okay, I'm still going through it all, I'm just floored that I got mmc to spit out a runtime error.<div><br></div><div><div>Making Mercury/asm_fast.gc.trseg.debug.stseg/x86_64-pc-linux-gnu/Mercury/cs/luaMR.state.c</div>
<div>Uncaught Mercury exception:</div><div>Software Error: hlds.instmap: predicate `hlds.instmap.instmapping_set_vars_corresponding'/4: Unexpected: not_reached</div></div><div><br></div><div>Here's a pastebin of the source I was working on: <a href="http://pastebin.com/Z6Fau9b3">http://pastebin.com/Z6Fau9b3</a></div>
<div><br></div><div>The lines that I was editing (trying to get the switch to infer as det) when mmc started to throw exceptions are 682 - 684. The entire clause is pasted for convenience. </div><div><br></div><div><div>
lua_pcall(L, A) = R :-</div><div><span class="" style="white-space:pre"> </span>impure Result = lua_pcall(L, A, 0),</div><div><span class="" style="white-space:pre"> </span>( Result = returned(R) % line 682</div><div><span class="" style="white-space:pre"> </span>; Result = returned_error(Error), throw(Error) </div>
<div><span class="" style="white-space:pre"> </span>; unexpected($module, $pred, "Invalid result value. (WTF?)")<span class="" style="white-space:pre"> % line 684</span></div><div><span class="" style="white-space:pre"> </span>).</div>
</div><div><br></div><div>Using if-> calls rather than raw disjuncts originally triggered this. I'm going to be focusing on trying to re-arrange this clause in a manner that does not cause mmc to toss cookies.</div>
<div><br></div><div>I've located the exception I've triggered in the source, instmap.m line 600, although I don't know the inner workings of the compiler to begin knowing how to interpret it.</div><div><br></div>
<div><span class="" style="color:rgb(153,0,0);font-weight:bold;font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:12px;line-height:16.799999237060547px;white-space:pre">expect</span><span class="" style="color:rgb(51,51,51);font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:12px;line-height:16.799999237060547px;white-space:pre">(</span><span class="" style="color:rgb(153,0,0);font-weight:bold;font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:12px;line-height:16.799999237060547px;white-space:pre">negate</span><span class="" style="color:rgb(51,51,51);font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:12px;line-height:16.799999237060547px;white-space:pre">(</span><span class="" style="color:rgb(153,0,0);font-weight:bold;font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:12px;line-height:16.799999237060547px;white-space:pre">unify</span><span class="" style="color:rgb(51,51,51);font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:12px;line-height:16.799999237060547px;white-space:pre">(</span><span class="" style="color:teal;font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:12px;line-height:16.799999237060547px;white-space:pre">Inst</span><span class="" style="color:rgb(51,51,51);font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:12px;line-height:16.799999237060547px;white-space:pre">,</span><span style="color:rgb(51,51,51);font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:12px;line-height:16.799999237060547px;white-space:pre"> </span><span class="" style="color:rgb(51,51,51);font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:12px;line-height:16.799999237060547px;white-space:pre">not_reached</span><span class="" style="color:rgb(51,51,51);font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:12px;line-height:16.799999237060547px;white-space:pre">)),</span><span style="color:rgb(51,51,51);font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:12px;line-height:16.799999237060547px;white-space:pre"> </span><span class="" style="color:rgb(166,23,23);font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:12px;line-height:16.799999237060547px;white-space:pre;background-color:rgb(227,210,210)">$</span><span class="" style="color:rgb(51,51,51);font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:12px;line-height:16.799999237060547px;white-space:pre">module</span><span class="" style="color:rgb(51,51,51);font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:12px;line-height:16.799999237060547px;white-space:pre">,</span><span style="color:rgb(51,51,51);font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:12px;line-height:16.799999237060547px;white-space:pre"> </span><span class="" style="color:rgb(166,23,23);font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:12px;line-height:16.799999237060547px;white-space:pre;background-color:rgb(227,210,210)">$</span><span class="" style="color:rgb(51,51,51);font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:12px;line-height:16.799999237060547px;white-space:pre">pred</span><span class="" style="color:rgb(51,51,51);font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:12px;line-height:16.799999237060547px;white-space:pre">,</span><span style="color:rgb(51,51,51);font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:12px;line-height:16.799999237060547px;white-space:pre"> </span><span class="" style="color:rgb(221,17,68);font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:12px;line-height:16.799999237060547px;white-space:pre">"not_reached"</span><span class="" style="color:rgb(51,51,51);font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:12px;line-height:16.799999237060547px;white-space:pre">),</span></div>
<div><br></div><div>I'm not asking for or expecting any kind of specific assistance or response, I'll be trying to bypass this by trial and error, I figured that this was the kind of thing that would be productive to bring attention to as a bug report, not that I have a clue to what is causing it. I believe this is my first post to the list, you guys have been awesome on #mercury. I want to do everything I can to support both this community and the development of this language.</div>
<div><br></div><div>Note: I also compiled the same code under asm_fast.gc.trseg and got the same response. </div><div><br></div><div><br></div></div>