https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63581

            Bug ID: 63581
           Summary: undefined references in debug_info
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: debug
          Assignee: unassigned at gcc dot gnu.org
          Reporter: xur at google dot com

Created attachment 33752
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=33752&action=edit
reproducer

I got the following error when compiling a file with FDO.

/tmp/cc6azLyK.o:(.debug_info+0x228): undefined reference to `.L29'

The error is triggered by function splitting. Adding
-fno-reorder-blocks-and-partition will make the build pass.

Here is the diagnosis: 
We generate a label die and assume the label instruction will be generated in
final pass. This label is marked as deleted, but because it's a user
defined label, we should output it in the final pass. 

This label instruction is removed from insn stream in
record_effective_endpoints() and put the header of one bb and later
merged to the footer of another. The bb footer got overwritten in
emit_barrier_after_bb() (from add_labels_and_missing_jumps()). Since it's
overwritten, it never gets to put back to inst stream in cfg_layout_finalize.

I think the overwritten in emit_barrier_after_bb() is wrong. We should append
to the bb footer if the footer contains non-barrier instruction.

Once I do the appending, the label is emitted.

Reproducer attached. Build instructions are in the head of the file.

Reply via email to