http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57451
Bug ID: 57451 Summary: Incorrect debug ranges emitted for -freorder-blocks-and-partition -g Product: gcc Version: 4.8.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: rtl-optimization Assignee: unassigned at gcc dot gnu.org Reporter: tejohnson at google dot com Created attachment 30214 --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=30214&action=edit pr49115.C While fixing problems with -freorder-blocks-and-partition, I found that the debug ranges being emitted for split functions with -g are incorrect and leading to assembler errors. I've attached a simple reproducer (gcc/testsuite/g++.dg/torture/pr49115.C). To reproduce: $ g++ pr49115.C -O2 -o pr49115 -fprofile-generate $ pr49115 $ g++ pr49115.C -O2 -o pr49115 -fprofile-use -g -freorder-blocks-and-partition /tmp/ccStx78Y.s: Assembler messages: /tmp/ccStx78Y.s:325: Error: can't resolve `.text.unlikely' {.text.unlikely section} - `.LBB14' {.text.startup section} The problem is hidden if the last compile step is changed to drop either -g or -freorder-blocks-and-partition, or by adding -gdwarf-2 (which doesn't trigger debug_range support).