<div dir="ltr"><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Jul 2, 2013 at 9:09 PM, Paul Bone <span dir="ltr"><<a href="mailto:paul@bone.id.au" target="_blank">paul@bone.id.au</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
A user reported to me a bug whereby a program (not even a parallel one) can<br>
crash (segfault) in a parallel low-level C grade.<br>
<br>
I've narrowed this down to GCC 4.6 and 4.7, (maybe later versions too), and<br>
the -freorder-functions optimisation that is enabled at -O2. I think that<br>
calling a clusure is somehow involved - perhaps it's what is required to<br>
make the bug come to the surface.<br>
<br>
Does anyone know how these three things: -freorder-functions,<br>
parallelism/thread safty and closures may cause such a program. In<br>
particular do we at any point rely on the order that functions appear in an<br>
executable's .text area? This may just be an edge case that we havn't hit<br>
before with Mercury's use of non-local gotos.<br>
<br>
I've disassembled both object files (working and broken) for the same<br>
program and diffed them, there's no difference. There is a difference in<br>
the disassembly of the _init.o file, the main function is placed in a new<br>
section named .text.startup. I can't imagine how this could contribute to<br>
the problem.</blockquote><div><br></div><div>What about in the object file for the runtime? (Particularly, any contain code</div><div>that deals with closures.)</div><div><br></div><div>Cheers,</div><div>Julien.</div><div>
</div></div><br></div></div>