Bug 485940

Summary: DW_TAG_label without DW_AT_low_pc
Product: Red Hat Enterprise Linux 5 Reporter: Stan Cox <scox>
Component: gccAssignee: Jakub Jelinek <jakub>
Status: CLOSED NOTABUG QA Contact: BaseOS QE <qe-baseos-auto>
Severity: medium Docs Contact:
Priority: low    
Version: 5.2CC: mjw, roland
Target Milestone: rc   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2009-03-31 17:38:51 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
test program none

Description Stan Cox 2009-02-17 16:03:06 UTC
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
2.
3.
  
Actual results:
    <1220>   DW_AT_name        : (indirect string, offset: 0xf10): _stapprobe1_t
ransaction__start_1550  
    <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 16:17:18 UTC
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 12:26:43 UTC
        .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 19:55:43 UTC
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 17:38:51 UTC
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.