Bug 634284 - DWARF label pc is out of its DIE range
Summary: DWARF label pc is out of its DIE range
Status: CLOSED EOL
Alias: None
Product: Fedora
Classification: Fedora
Component: gcc
Version: 27
Hardware: All
OS: Linux
low
medium
Target Milestone: ---
Assignee: Jakub Jelinek
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Keywords: Reopened, Triaged
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2010-09-15 17:55 UTC by Josh Stone
Modified: 2018-11-30 18:16 UTC (History)
3 users (show)

(edit)
Clone Of:
(edit)
Last Closed: 2018-11-30 18:16:16 UTC


Attachments (Terms of Use)

Description Josh Stone 2010-09-15 17:55:43 UTC
Description of problem:
In an inlined function, gcc generates a DW_TAG_label with a DW_AT_low_pc that's not contained by the inlined_subroutine DIE.

Version-Release number of selected component (if applicable):
gcc-4.4.4-10.fc13.x86_64

How reproducible:
100%

Steps to Reproduce:

A simple test program, compile with -g -O2:
  extern void exit (int);
  static void foo (void)
  {
   x:
    exit (0);
  }
  int main (void)
  {
    foo ();
    return 0;
  }
  
Actual results:

$ eu-readelf --debug-dump=info badlabel
[...]
 [    40]    subprogram
             external             (flag) Yes
             name                 (strp) "main"
             decl_file            (data1) 1
             decl_line            (data1) 9
             prototyped           (flag) Yes
             type                 (ref4) [    9b]
             low_pc               (addr) 0x00000000004004d0 <main>
             high_pc              (addr) 0x00000000004004db
             frame_base           (block1)               [   0] call_frame_cfa
             sibling              (ref4) [    9b]
 [    63]      inlined_subroutine
               abstract_origin      (ref4) [    2d]
               low_pc               (addr) 0x00000000004004d4 <main+0x4>
               high_pc              (addr) 0x00000000004004db
               call_file            (data1) 1
               call_line            (data1) 11
 [    7a]        lexical_block
                 low_pc               (addr) 0x00000000004004d4 <main+0x4>
                 high_pc              (addr) 0x00000000004004db
 [    8b]          label
                   abstract_origin      (ref4) [    3a]
                   low_pc               (addr) 0x00000000004004d0 <main>

Note how the label at 4d0 is outside the range of its inlined function DIE, from 4d4-4db.

Expected results:
The label ought to be contained by its proper DIE scope.

Additional info:
Using -O1 puts the label in the right place, even though foo is still inlined.

Roland has a more complicated testcase where this bad label placement has more impact.  He's using labels to try to give a well-defined probe/breakpoint for variable access, so it's harmful when the label pc isn't even in the right lexical scope.
http://sourceware.org/git/?p=systemtap.git;a=blob_plain;f=testsuite/systemtap.base/implicitptr.c;hb=59c305264d8a0b99b78ef68a153429ea4b2a0048

Comment 1 Bug Zapper 2011-05-31 13:24:44 UTC
This message is a reminder that Fedora 13 is nearing its end of life.
Approximately 30 (thirty) days from now Fedora will stop maintaining
and issuing updates for Fedora 13.  It is Fedora's policy to close all
bug reports from releases that are no longer maintained.  At that time
this bug will be closed as WONTFIX if it remains open with a Fedora 
'version' of '13'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, simply change the 'version' 
to a later Fedora version prior to Fedora 13's end of life.

Bug Reporter: Thank you for reporting this issue and we are sorry that 
we may not be able to fix it before Fedora 13 is end of life.  If you 
would still like to see this bug fixed and are able to reproduce it 
against a later version of Fedora please change the 'version' of this 
bug to the applicable version.  If you are unable to change the version, 
please add a comment here and someone will do it for you.

Although we aim to fix as many bugs as possible during every release's 
lifetime, sometimes those efforts are overtaken by events.  Often a 
more recent Fedora release includes newer upstream software that fixes 
bugs or makes them obsolete.

The process we are following is described here: 
http://fedoraproject.org/wiki/BugZappers/HouseKeeping

Comment 2 Josh Stone 2011-05-31 16:38:46 UTC
The reproducer still has this issue with gcc-4.6.0-7.fc15.x86_64

Comment 3 Aravind vijayan 2012-01-08 15:16:24 UTC
Hi Josh Stone,
            Please update your gcc version.

Comment 4 Josh Stone 2012-01-16 20:42:01 UTC
(In reply to comment #3)
> Please update your gcc version.

I tried the following gcc versions, and all still have this issue.

gcc-4.6.1-9.fc15.i686
gcc-4.6.1-9.fc15.x86_64
gcc-4.6.2-1.fc16.i686
gcc-4.6.2-1.fc16.x86_64
gcc-4.7.0-0.6.fc17.i686
gcc-4.7.0-0.6.fc17.x86_64

Comment 5 Fedora End Of Life 2012-08-07 20:13:05 UTC
This message is a notice that Fedora 15 is now at end of life. Fedora
has stopped maintaining and issuing updates for Fedora 15. It is
Fedora's policy to close all bug reports from releases that are no
longer maintained. At this time, all open bugs with a Fedora 'version'
of '15' have been closed as WONTFIX.

(Please note: Our normal process is to give advanced warning of this
occurring, but we forgot to do that. A thousand apologies.)

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, feel free to reopen
this bug and simply change the 'version' to a later Fedora version.

Bug Reporter: Thank you for reporting this issue and we are sorry that
we were unable to fix it before Fedora 15 reached end of life. If you
would still like to see this bug fixed and are able to reproduce it
against a later version of Fedora, you are encouraged to click on
"Clone This Bug" (top right of this page) and open it against that
version of Fedora.

Although we aim to fix as many bugs as possible during every release's
lifetime, sometimes those efforts are overtaken by events. Often a
more recent Fedora release includes newer upstream software that fixes
bugs or makes them obsolete.

The process we are following is described here:
http://fedoraproject.org/wiki/BugZappers/HouseKeeping

Comment 6 Josh Stone 2012-08-09 01:18:07 UTC
The issue persists in gcc-4.7.0-5.fc17.x86_64

Comment 7 Fedora End Of Life 2013-07-04 06:47:06 UTC
This message is a reminder that Fedora 17 is nearing its end of life.
Approximately 4 (four) weeks from now Fedora will stop maintaining
and issuing updates for Fedora 17. It is Fedora's policy to close all
bug reports from releases that are no longer maintained. At that time
this bug will be closed as WONTFIX if it remains open with a Fedora 
'version' of '17'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, simply change the 'version' 
to a later Fedora version prior to Fedora 17's end of life.

Bug Reporter:  Thank you for reporting this issue and we are sorry that 
we may not be able to fix it before Fedora 17 is end of life. If you 
would still like  to see this bug fixed and are able to reproduce it 
against a later version  of Fedora, you are encouraged  change the 
'version' to a later Fedora version prior to Fedora 17's end of life.

Although we aim to fix as many bugs as possible during every release's 
lifetime, sometimes those efforts are overtaken by events. Often a 
more recent Fedora release includes newer upstream software that fixes 
bugs or makes them obsolete.

Comment 8 Fedora End Of Life 2013-08-01 18:25:14 UTC
Fedora 17 changed to end-of-life (EOL) status on 2013-07-30. Fedora 17 is 
no longer maintained, which means that it will not receive any further 
security or bug fix updates. As a result we are closing this bug.

If you can reproduce this bug against a currently maintained version of 
Fedora please feel free to reopen this bug against that version.

Thank you for reporting this bug and we are sorry it could not be fixed.

Comment 9 Josh Stone 2013-08-20 20:57:38 UTC
(In reply to Fedora End Of Life from comment #8)
> If you can reproduce this bug against a currently maintained version of 
> Fedora please feel free to reopen this bug against that version.

Reopening once again; the issue persists in gcc-4.8.1-1.fc19.x86_64.

Comment 10 Fedora End Of Life 2015-01-09 21:45:37 UTC
This message is a notice that Fedora 19 is now at end of life. Fedora 
has stopped maintaining and issuing updates for Fedora 19. It is 
Fedora's policy to close all bug reports from releases that are no 
longer maintained. Approximately 4 (four) weeks from now this bug will
be closed as EOL if it remains open with a Fedora 'version' of '19'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, simply change the 'version' 
to a later Fedora version.

Thank you for reporting this issue and we are sorry that we were not 
able to fix it before Fedora 19 is end of life. If you would still like 
to see this bug fixed and are able to reproduce it against a later version 
of Fedora, you are encouraged  change the 'version' to a later Fedora 
version prior this bug is closed as described in the policy above.

Although we aim to fix as many bugs as possible during every release's 
lifetime, sometimes those efforts are overtaken by events. Often a 
more recent Fedora release includes newer upstream software that fixes 
bugs or makes them obsolete.

Comment 11 Josh Stone 2015-01-09 22:38:37 UTC
Persists on gcc-4.9.2-1.fc21.x86_64

Comment 12 Josh Stone 2015-01-09 23:08:07 UTC
It's possible to automate this check with dwgrep, e.g.:

$ dwgrep -e 'entry dup parent ?(address swap low !contains)' ./badlabel
---
[73]    lexical_block
        low_pc (addr)   0x400444;
        high_pc (data8) 7;
[84]    label
        abstract_origin (ref4)  [35];
        low_pc (addr)   0x400440;
---
[73]    lexical_block
        low_pc (addr)   0x400444;
        high_pc (data8) 7;
[91]    GNU_call_site
        low_pc (addr)   0x40044b;
        abstract_origin (ref4)  [ae];

I haven't noticed the call site before, but that's sitting right at the end address of main.  DIE "ae" is the exit subprogram.

Comment 13 Fedora End Of Life 2015-11-04 15:45:30 UTC
This message is a reminder that Fedora 21 is nearing its end of life.
Approximately 4 (four) weeks from now Fedora will stop maintaining
and issuing updates for Fedora 21. It is Fedora's policy to close all
bug reports from releases that are no longer maintained. At that time
this bug will be closed as EOL if it remains open with a Fedora  'version'
of '21'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, simply change the 'version' 
to a later Fedora version.

Thank you for reporting this issue and we are sorry that we were not 
able to fix it before Fedora 21 is end of life. If you would still like 
to see this bug fixed and are able to reproduce it against a later version 
of Fedora, you are encouraged  change the 'version' to a later Fedora 
version prior this bug is closed as described in the policy above.

Although we aim to fix as many bugs as possible during every release's 
lifetime, sometimes those efforts are overtaken by events. Often a 
more recent Fedora release includes newer upstream software that fixes 
bugs or makes them obsolete.

Comment 14 Josh Stone 2015-11-04 19:37:11 UTC
+ rpm -q gcc
gcc-5.1.1-4.fc23.x86_64
+ gcc -g -O2 -o badlabel badlabel.c
+ dwgrep -f uncontained-die.dwgrep ./badlabel
---
[73]    lexical_block
        low_pc  0x400524
        high_pc 7
[84]    label
        abstract_origin [35] label
        low_pc  0x400520
---
[73]    lexical_block
        low_pc  0x400524
        high_pc 7
[91]    GNU_call_site
        low_pc  0x40052b
        abstract_origin [ae] subprogram

Comment 15 Fedora End Of Life 2016-11-24 10:28:03 UTC
This message is a reminder that Fedora 23 is nearing its end of life.
Approximately 4 (four) weeks from now Fedora will stop maintaining
and issuing updates for Fedora 23. It is Fedora's policy to close all
bug reports from releases that are no longer maintained. At that time
this bug will be closed as EOL if it remains open with a Fedora  'version'
of '23'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, simply change the 'version' 
to a later Fedora version.

Thank you for reporting this issue and we are sorry that we were not 
able to fix it before Fedora 23 is end of life. If you would still like 
to see this bug fixed and are able to reproduce it against a later version 
of Fedora, you are encouraged  change the 'version' to a later Fedora 
version prior this bug is closed as described in the policy above.

Although we aim to fix as many bugs as possible during every release's 
lifetime, sometimes those efforts are overtaken by events. Often a 
more recent Fedora release includes newer upstream software that fixes 
bugs or makes them obsolete.

Comment 16 Josh Stone 2016-11-28 18:43:28 UTC
+ rpm -q gcc
gcc-6.2.1-2.fc25.x86_64
+ gcc -g -O2 -o badlabel badlabel.c
+ dwgrep -f uncontained-die.dwgrep ./badlabel
---
[61]	lexical_block
	low_pc	0x400404
	high_pc	7
[72]	label
	abstract_origin	[a8] label
	low_pc	0x400400
---
[61]	lexical_block
	low_pc	0x400404
	high_pc	7
[7f]	GNU_call_site
	low_pc	0x40040b
	abstract_origin	[ae] subprogram

Comment 17 Fedora End Of Life 2017-11-16 19:43:36 UTC
This message is a reminder that Fedora 25 is nearing its end of life.
Approximately 4 (four) weeks from now Fedora will stop maintaining
and issuing updates for Fedora 25. It is Fedora's policy to close all
bug reports from releases that are no longer maintained. At that time
this bug will be closed as EOL if it remains open with a Fedora  'version'
of '25'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, simply change the 'version'
to a later Fedora version.

Thank you for reporting this issue and we are sorry that we were not
able to fix it before Fedora 25 is end of life. If you would still like
to see this bug fixed and are able to reproduce it against a later version
of Fedora, you are encouraged  change the 'version' to a later Fedora
version prior this bug is closed as described in the policy above.

Although we aim to fix as many bugs as possible during every release's
lifetime, sometimes those efforts are overtaken by events. Often a
more recent Fedora release includes newer upstream software that fixes
bugs or makes them obsolete.

Comment 18 Josh Stone 2017-11-16 22:48:36 UTC
The behavior has not changed:

+ rpm -q gcc
gcc-7.2.1-2.fc27.x86_64
+ gcc -g -O2 -o badlabel badlabel.c
+ dwgrep -f uncontained-die.dwgrep ./badlabel
---
[61]    lexical_block
        low_pc  0x400404
        high_pc 7
[72]    label
        abstract_origin [a8] label
        low_pc  0x400400
---
[61]    lexical_block
        low_pc  0x400404
        high_pc 7
[7f]    GNU_call_site
        low_pc  0x40040b
        abstract_origin [ae] subprogram

Comment 19 Ben Cotton 2018-11-27 18:12:26 UTC
This message is a reminder that Fedora 27 is nearing its end of life.
On 2018-Nov-30  Fedora will stop maintaining and issuing updates for
Fedora 27. It is Fedora's policy to close all bug reports from releases
that are no longer maintained. At that time this bug will be closed as
EOL if it remains open with a Fedora  'version' of '27'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, simply change the 'version' 
to a later Fedora version.

Thank you for reporting this issue and we are sorry that we were not 
able to fix it before Fedora 27 is end of life. If you would still like 
to see this bug fixed and are able to reproduce it against a later version 
of Fedora, you are encouraged  change the 'version' to a later Fedora 
version prior this bug is closed as described in the policy above.

Although we aim to fix as many bugs as possible during every release's 
lifetime, sometimes those efforts are overtaken by events. Often a 
more recent Fedora release includes newer upstream software that fixes 
bugs or makes them obsolete.

Comment 20 Ben Cotton 2018-11-30 18:16:16 UTC
Fedora 27 changed to end-of-life (EOL) status on 2018-11-30. Fedora 27 is
no longer maintained, which means that it will not receive any further
security or bug fix updates. As a result we are closing this bug.

If you can reproduce this bug against a currently maintained version of
Fedora please feel free to reopen this bug against that version. If you
are unable to reopen this bug, please file a new report against the
current release. If you experience problems, please add a comment to this
bug.

Thank you for reporting this bug and we are sorry it could not be fixed.


Note You need to log in before you can comment on or make changes to this bug.