http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48625
--- Comment #3 from Patrick Marlier <patrick.marlier at gmail dot com> 2011-05-03 12:06:13 UTC --- The problem is that _ITM_beginTransaction shouldn't have caller save optimization because if the transaction aborts, registers will get random values. It should be ok for others ITM functions. I fixed it by adding RETURN_TWICE attribute to BUILT_IN_TM_START as a workaround but I know it shouldn't be fixed like this. I had a look into gcc sources but I didn't find the right way to fix it. By the way, if a user wants to use explicit calls to _ITM_ functions to create its TM program, _ITM_beginTransaction should have a specific attribute to avoid caller save optimization. In the same way, the tail call optimization must be forbidden on _ITM_commitTransaction. How should it be managed? Patrick Marlier.