Bug 527430 - DW_AT_const_value duplicated between DW_TAG_variable abstract declaration and instance
Summary: DW_AT_const_value duplicated between DW_TAG_variable abstract declaration and...
Keywords:
Status: CLOSED RAWHIDE
Alias: None
Product: Fedora
Classification: Fedora
Component: gcc
Version: rawhide
Hardware: All
OS: Linux
low
medium
Target Milestone: ---
Assignee: Jakub Jelinek
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2009-10-06 12:07 UTC by Mark Wielaard
Modified: 2009-10-08 19:08 UTC (History)
1 user (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2009-10-08 19:08:46 UTC
Type: ---
Embargoed:


Attachments (Terms of Use)

Description Mark Wielaard 2009-10-06 12:07:25 UTC
Description of problem:

DW_AT_const_value is unnecessary duplicated.

Version-Release number of selected component (if applicable):

GNU C 4.4.1 20091001 (Red Hat 4.4.1-18)

How reproducible:

Always

Steps to Reproduce:
1. cat const.c
struct foo
{
  const int i;
  const long j;
};

typedef struct foo fooer;

static int
bar (const int i, const long j)
{
  return i * j;
}

static int
func (int (*f) ())
{
  const fooer baz = { .i = 2, .j = 21 };
  return f(baz.i, baz.j);
}

int
main (int argc, char *argv[], char *envp[])
{
  return func (&bar) - 42;
}

2. gcc -g -O2 -o const const.c

3. readelf --debug-dump=info const

Actual results:

 <2><8b>: Abbrev Number: 10 (DW_TAG_variable)
    <8c>   DW_AT_name        : baz      
    <90>   DW_AT_decl_file   : 1        
    <91>   DW_AT_decl_line   : 18       
    <92>   DW_AT_type        : <0xb9>   
    <96>   DW_AT_const_value : 16 byte block: 2 0 0 0 0 0 0 0 15 0 0 0 0 0 0 0  
[...]
 <4><17c>: Abbrev Number: 21 (DW_TAG_variable)
    <17d>   DW_AT_abstract_origin: <0x8b>       
    <181>   DW_AT_const_value : 16 byte block: 2 0 0 0 0 0 0 0 15 0 0 0 0 0 0 0         

Expected results:

Not having the DW_AT_const_value in the instance when the value is already in the abstract_origin.

Comment 1 Jakub Jelinek 2009-10-08 19:08:46 UTC
Fixed in gcc-4.4.1-20.fc12.


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