Bug 63581 - undefined references in debug_info
Summary: undefined references in debug_info
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: debug (show other bugs)
Version: unknown
: P3 normal
Target Milestone: 5.0
Assignee: Not yet assigned to anyone
URL:
Keywords:
: 64593 (view as bug list)
Depends on:
Blocks:
 
Reported: 2014-10-17 21:21 UTC by xur
Modified: 2021-09-18 07:48 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed:


Attachments
reproducer (493 bytes, text/x-csrc)
2014-10-17 21:21 UTC, xur
Details

Note You need to log in before you can comment on or make changes to this bug.
Description xur 2014-10-17 21:21:37 UTC
Created attachment 33752 [details]
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.
Comment 1 xur 2014-10-17 21:57:46 UTC
Patches is here:
https://gcc.gnu.org/ml/gcc-patches/2014-10/msg01795.html
Comment 2 xur 2014-11-14 00:31:03 UTC
Author: xur
Date: Fri Nov 14 00:30:31 2014
New Revision: 217530

URL: https://gcc.gnu.org/viewcvs?rev=217530&root=gcc&view=rev
Log:
2014-11-13  Rong Xu  <xur@google.com>

gcc:
	PR debug/63581
	* cfgrtl.c (emit_barrier_after_bb): Append the barrier to the
 	footer, instead of unconditionally overwritten

gcc/testsuite:
	PR debug/63581
	* g++.dg/tree-prof/pr63581.C: New test.


Added:
    trunk/gcc/testsuite/g++.dg/tree-prof/pr63581.C
Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/cfgrtl.c
    trunk/gcc/testsuite/ChangeLog
Comment 3 Andrew Pinski 2016-09-15 08:34:38 UTC
Fixed a long time ago.
Comment 4 Andrew Pinski 2021-09-18 07:48:17 UTC
*** Bug 64593 has been marked as a duplicate of this bug. ***