Bug 40713 - Overlapping .debug_ranges (C++)
Summary: Overlapping .debug_ranges (C++)
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: debug (show other bugs)
Version: 4.5.0
: P3 normal
Target Milestone: ---
Assignee: Jakub Jelinek
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-07-10 15:16 UTC by Jan Kratochvil
Modified: 2011-10-11 11:48 UTC (History)
2 users (show)

See Also:
Host:
Target: x86_64-unknown-linux-gnu
Build:
Known to work:
Known to fail:
Last reconfirmed: 2009-07-10 18:27:42


Attachments
gcc45-pr40713.patch (1.09 KB, patch)
2009-07-10 19:33 UTC, Jakub Jelinek
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Jan Kratochvil 2009-07-10 15:16:27 UTC
class C { 
  C();
  void f() {};
};
C::C() { f(); };

g++ -c -o cu-overlap.o cu-overlap.C -g -O0
readelf --debug-dump=Ranges cu-overlap.o

Contents of the .debug_ranges section:
    Offset   Begin            End
    00000000 0000000000000000 0000000000000034
    00000000 0000000000000000 000000000000000a
    00000000 0000000000000000 000000000000001a
    00000000 000000000000001a 0000000000000034
    00000000 <End of list>

Relocation section '.rela.debug_ranges' at offset 0x1560 contains 8 entries:
    Offset             Type      Symbol's Value  Symbol's Name + Addend 
0000000000000000  R_X86_64_64   0000000000000000 .text + 0
0000000000000008  R_X86_64_64   0000000000000000 .text + 34
0000000000000010  R_X86_64_64   0000000000000000 .text._ZN1C1fEv + 0
0000000000000018  R_X86_64_64   0000000000000000 .text._ZN1C1fEv + a
0000000000000020  R_X86_64_64   0000000000000000 .text + 0
0000000000000028  R_X86_64_64   0000000000000000 .text + 1a
0000000000000030  R_X86_64_64   0000000000000000 .text + 1a
0000000000000038  R_X86_64_64   0000000000000000 .text + 34


DWARF3 2.17.3: Address range entries in a range list may not overlap.

Contents of the .debug_ranges section:
    Offset   Begin            End
1st 00000000 0000000000000000 0000000000000034 - is from .Ltext0 .. .Letext0
2nd 00000000 0000000000000000 000000000000000a - NOT overlapping, COMDAT C::f()
3rd 00000000 0000000000000000 000000000000001a - is from first C::C() instance
4th 00000000 000000000000001a 0000000000000034 - is from second C::C() instance

1st overlaps with 3rd+4th.
Comment 1 Jakub Jelinek 2009-07-10 19:33:44 UTC
Created attachment 18176 [details]
gcc45-pr40713.patch

Untested patch.
Comment 2 Jakub Jelinek 2009-07-11 17:42:12 UTC
Subject: Bug 40713

Author: jakub
Date: Sat Jul 11 17:41:59 2009
New Revision: 149514

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=149514
Log:
	PR debug/40713
	* dwarf2out.c (dw_fde_struct): Add in_std_section and
	cold_in_std_section bits.
	(dwarf2out_begin_prologue): Initialize them.
	(dwarf2out_finish): Don't emit FDE range into .debug_ranges
	if already covered by text_section or cold_text_section range.

Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/dwarf2out.c

Comment 3 Jakub Jelinek 2010-05-24 11:13:34 UTC
Fixed.
Comment 4 Paulo J. Matos 2011-10-11 10:34:52 UTC
This also seems to occur on gcc 4.3.6, is the patch ever going to be backported there?
Comment 5 Paolo Carlini 2011-10-11 10:40:33 UTC
As the home page says, 4.4.x is the oldest maintained branch..
Comment 6 Paulo J. Matos 2011-10-11 11:48:08 UTC
(In reply to comment #5)
> As the home page says, 4.4.x is the oldest maintained branch..

Right! Sorry for the noise.