http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46916
--- Comment #48 from Jan Hubicka <hubicka at gcc dot gnu.org> 2010-12-15 00:06:12 UTC --- Uh, this is getting confusing. We are really tracking 3 problems iteracting with each other (and prevosly hidding each other) 1) darwin_text_section returns unlikely_text section that leads to infinite recursion after the patch preventing darwin_function_section to partition functions with -fno-partition-functions This is preferably fixed by making darwin_function_section to return only the default section, but we do have alternative fix adding unlikely function as predefined section. We also have alternative patch here that scratch the USE_SELECT_SECTION_FOR_FUNCTIONS hack. That one should test independently with only problem demonstrated by 2). 2) -freorder-blocks-and-partition does not imply -freorder-functions. This means that -O0 we do not actual partition, since hot and cold section is forced by be same by my change to function_section that triggered the PR This demonstrate as the partition failure and should be solved by the hunk enabling reorder functions when -freorder-blocks-and-partition is given. I had typo in the original change I pasted here that it enabled -freorder-blocks instead. Just scratch that vairant. 3) the fact that we produce wrong assembly with 2 instead of missing optimization actually uncovers bigger problem that we seem to screw up when function partition is enabled but we do not really partition the given function. In this case we do most of the code pesimization and worse yet, we tend to mess up EH. This should be fixed by the patch I sent to PR but for some reason it breaks stackalign. Do we have any idea why? I guess we ought to be able to solve 1) and 2) in parallel and 3) incrementally.