http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51727
--- Comment #16 from Simon Baldwin <simonb at google dot com> 2012-10-13 08:08:30 UTC --- (In reply to comment #15) > ... > This has not been the case since 2007, even though it appears to make a lot of > sense... I noticed the same thing while investigating this. write_symbol1 visits every node and writes all unwritten ones, marking them written. Because writing a node may add new nodes, write_symbol1's caller iterates it until no more writes occur. Before reporting the issue I tried several speculative solutions, with no real success. I experimented with the two-step mechanism you mention, but could not convince myself that it would solve the problem. A full tree built before really writing any node still seemed to leave something ordered by (unpredictable) pointer and with integer "tags" that are partially a function of the pointers they represent. I'm not quite seeing how your patch fixes this; it orders writes by tag *within* write_symbol1 calls, but not *across* them. It is hard to reproduce this problem at all. I see it in only one of multiple gcc configurations. It is also hard to evaluate possible solutions -- adding a failed "non-solution" can change the relationship between pointers enough to make the symptoms disappear while not solving the actual problem.