Bug 485940 - DW_TAG_label without DW_AT_low_pc
DW_TAG_label without DW_AT_low_pc
Product: Red Hat Enterprise Linux 5
Classification: Red Hat
Component: gcc (Show other bugs)
All Linux
low Severity medium
: rc
: ---
Assigned To: Jakub Jelinek
Depends On:
  Show dependency treegraph
Reported: 2009-02-17 11:03 EST by Stan Cox
Modified: 2009-03-31 13:38 EDT (History)
2 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2009-03-31 13:38:51 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)
test program (48.34 KB, application/x-bzip2)
2009-02-17 11:03 EST, Stan Cox
no flags Details

  None (edit)
Description Stan Cox 2009-02-17 11:03:06 EST
Created attachment 332235 [details]
test program

Description of problem:
The majority of the time a DW_TAG_label has an associated DW_AT_low_pc, however in some circumstances it does not.

Version-Release number of selected component (if applicable):
Tested with both 4.3.2 and 4.4.0

How reproducible:

Steps to Reproduce:
1. gcc -O2 -Wall -W -c xact.i -g && readelf --debug-dump xact.o | less -pstapprobe
Actual results:
    <1220>   DW_AT_name        : (indirect string, offset: 0xf10): _stapprobe1_t
    <1224>   DW_AT_decl_file   : 1      
    <1225>   DW_AT_decl_line   : 13348  

Expected results:
above plus
    <1273>   DW_AT_low_pc      : 0x0   

Additional info:
Comment 1 Mark Wielaard 2009-02-17 11:17:18 EST
Same issue can be seen with the system compiler:

$ gcc --version
gcc (GCC) 4.1.2 20080704 (Red Hat 4.1.2-44)

 [  11f8]      label
               name                 "_stapprobe1_transaction__start_1550"
               decl_file            1
               decl_line            13348

But no low_pc.
Comment 2 Jakub Jelinek 2009-03-11 08:26:43 EDT
        .uleb128 0x1f   # (DIE (0x122d) DW_TAG_label)
        .long   .LASF464        # DW_AT_name: "_stapprobe1_transaction__start_1550"
        .byte   0x1     # DW_AT_decl_file (xact.i)
        .value  0x3424  # DW_AT_decl_line
        .uleb128 0x2a   # (DIE (0x12fa) DW_TAG_label)
        .long   0x122d  # DW_AT_abstract_origin
        .quad   .L6     # DW_AT_low_pc

Why do you consider that a bug?  That DW_TAG_label die is just the abstract origin of the label, there is another DW_TAG_label with DW_AT_abstract_origin and DW_AT_loc_pw later on.  Why should we emit a DW_AT_low_pc when there isn't really one?  2.17 says:
"If an entity has no associated machine code, none of these attributes are specified."
and that's the case here.
Comment 3 Roland McGrath 2009-03-11 15:55:43 EDT
There is no bug if all observed cases missing PC attrs are like this one.
The consumer just needs to be using smarter methods.
Comment 4 Jakub Jelinek 2009-03-31 13:38:51 EDT
Closing, if you find a case where DW_TAG_label without DW_AT_low_pc doesn't have corresponding DW_TAG_label with it and pointing to it through DW_AT_abstract_origin (possibly transitively), please reopen.

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