[m-dev.] GCC 4.6, 4.7 and parallel grades

Paul Bone paul at bone.id.au
Tue Jul 2 21:09:05 AEST 2013


A user reported to me a bug whereby a program (not even a parallel one) can
crash (segfault) in a parallel low-level C grade.

I've narrowed this down to GCC 4.6 and 4.7, (maybe later versions too), and
the -freorder-functions optimisation that is enabled at -O2.  I think that
calling a clusure is somehow involved - perhaps it's what is required to
make the bug come to the surface.

Does anyone know how these three things: -freorder-functions,
parallelism/thread safty and closures may cause such a program.  In
particular do we at any point rely on the order that functions appear in an
executable's .text area?  This may just be an edge case that we havn't hit
before with Mercury's use of non-local gotos.

I've disassembled both object files (working and broken) for the same
program and diffed them, there's no difference.  There is a difference in
the disassembly of the _init.o file, the main function is placed in a new
section named .text.startup.  I can't imagine how this could contribute to
the problem.


-- 
Paul Bone
http://www.bone.id.au



More information about the developers mailing list