http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59639
Bug ID: 59639 Summary: Code in a cold basic block is not pushed to .text.unlikely Product: gcc Version: 4.8.2 Status: UNCONFIRMED Severity: minor Priority: P3 Component: tree-optimization Assignee: unassigned at gcc dot gnu.org Reporter: a...@cloudius-systems.com Consider the code: [[gnu::cold]] int slow_path(); int f() { asm goto ("" : : : : cold); return 1; cold: return slow_path(); } since slow_path() is cold, the compiler can infer that the basic block beginning with the cold: label is also cold, so it should be placed in .text.unlikely. Yet it isn't: 0000000000000000 <_Z1fv>: 0: b8 01 00 00 00 mov $0x1,%eax 5: c3 retq 6: e9 00 00 00 00 jmpq b <_Z1fv+0xb> Adding a cold attribute to the label doesn't help. Expected results: the jmpq instruction should be placed in .text.unlikely.