------- Comment #14 from iains at gcc dot gnu dot org 2010-05-17 20:22 ------- Created an attachment (id=20688) --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=20688&action=view) Work-In-Progress...
here is a modification of comment #7 which gets us a bit further .. but I'm a bit stumped in some areas. There are a couple of extra test-cases that I'm using locally to help testing (probably not for a final patch). === A. this checks for emutls vars in VAR/PARAM cases in gimplify. B. This moves the creation of the init template out of assemble_variable into emutls_decl () - as soon as we see a DECL_INITIAL we do it .. and then we mark the original decl with DECL_INITIAL=error_mark so that we still get a parse error if the user tries to init twice. C. emutls_final () carries out a pass through the emutls control vars finalizing them if they are not already done. D. the substitution of the control var is removed from gcc/expr.c. Mostly - this is working for tls.exp=* unfortunately -lto/-whopr are still killing the control vars (even @ O0) ==== Problems : 1/ It doesn't work with the race condition patch applied to tree-profile.c -- this is because tree-profile is emitting gimple directly and assuming that it doesn't need gimplification (and I've not been able to figure out how to fix that yet). 2/ It breaks libgomp quite a bit ... I'm guessing that there's another spot in gimplify.c that we need to apply the substitution but - can't see it yet .. ;) anyway ... Honza .. I'm sure you will see the solutions 10^6 times quicker than me... *** this is experimental *** (some way from a complete solution) -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=44132