public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/23057] New: Wrong DWARF output for Fortran common block
@ 2005-07-25  5:41 woodzltc at sources dot redhat dot com
  2005-07-25  7:35 ` [Bug fortran/23057] Fortran common blocks are not described with DW_TAG_common_block pinskia at gcc dot gnu dot org
                   ` (2 more replies)
  0 siblings, 3 replies; 8+ messages in thread
From: woodzltc at sources dot redhat dot com @ 2005-07-25  5:41 UTC (permalink / raw)
  To: gcc-bugs

In section 4.2 of DWARF STD, it says that:

A Fortran common block may be described by a debugging information entry 
with the tag DW_TAG_common_block. 

But it seems that both gfortran and g77 didn't conform to this.  This makes
trouble for debugging common block.  Here is a testcase to verify this: 

        program info_common
        implicit none
          integer :: a,b
          common /group1/ a,b
          a=1
          b=2
          call ShowCommon()
          stop
        end

        subroutine ShowCommon()
        implicit none
          integer :: num1, num2
          common /group1/ num1, num2
          write(*,*) num1, num2
          return
        end

group1 is a named common block.  After using gfortran to build this case, I use
"readelf -wi" to get the debuginfo of the executable:

 <2><9e>: Abbrev Number: 3 (DW_TAG_variable)
     DW_AT_name        : group1
     DW_AT_decl_file   : 1
     DW_AT_decl_line   : 4
     DW_AT_MIPS_linkage_name: group1_
     DW_AT_type        : <e1>        =====>  This point to the type of group1
     DW_AT_external    : 1
     DW_AT_location    : 5 byte block: 3 d0 99 4 8      (DW_OP_addr: 80499d0)
 <1><e1>: Abbrev Number: 5 (DW_TAG_structure_type)
     DW_AT_sibling     : <100>
     DW_AT_byte_size   : 8
 <2><e7>: Abbrev Number: 6 (DW_TAG_member)
     DW_AT_name        : a
     DW_AT_decl_file   : 1
     DW_AT_decl_line   : 3
     DW_AT_type        : <100>
     DW_AT_data_member_location: 2 byte block: 23 0     (DW_OP_plus_uconst: 0)
 <2><f3>: Abbrev Number: 6 (DW_TAG_member)
     DW_AT_name        : b
     DW_AT_decl_file   : 1
     DW_AT_decl_line   : 3
     DW_AT_type        : <100>
     DW_AT_data_member_location: 2 byte block: 23 4     (DW_OP_plus_uconst: 4)

It tells us that group1 is treated as a two-members structure.

g77 handles this in another way, it treats group1 as an eight-character array.
And eight is exactly the size of common block group1.  Here is the debuginfo for
g77-generated executable:

 <1><12b>: Abbrev Number: 6 (DW_TAG_base_type)
     DW_AT_name        : (indirect string, offset: 0x3b): char
     DW_AT_byte_size   : 1
     DW_AT_encoding    : 8      (unsigned char)
 <1><132>: Abbrev Number: 15 (DW_TAG_array_type)
     DW_AT_sibling     : <143>
     DW_AT_type        : <12b>
 <2><13b>: Abbrev Number: 16 (DW_TAG_subrange_type)
     DW_AT_type        : <70>
     DW_AT_lower_bound : 0
     DW_AT_upper_bound : 7
 <1><143>: Abbrev Number: 17 (DW_TAG_variable)
     DW_AT_name        : (indirect string, offset: 0xbb): group1_
     DW_AT_decl_file   : 1
     DW_AT_decl_line   : 3
     DW_AT_type        : <132>   =====>  This point to the type of group1
     DW_AT_external    : 1
     DW_AT_location    : 5 byte block: 3 a0 99 4 8      (DW_OP_addr: 80499a0)


P.S: I reported this problem some days before.  But there is no response ever
since.  Here is the link:  

  http://gcc.gnu.org/ml/fortran/2005-07/msg00310.html

Thanks.

-- 
           Summary: Wrong DWARF output for Fortran common block
           Product: gcc
           Version: 4.0.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: fortran
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: woodzltc at sources dot redhat dot com
                CC: gcc-bugs at gcc dot gnu dot org


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=23057


^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2008-08-29 18:48 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <bug-23057-10906@http.gcc.gnu.org/bugzilla/>
2007-10-28 14:24 ` [Bug fortran/23057] Fortran common blocks are not described with DW_TAG_common_block fxcoudert at gcc dot gnu dot org
2007-11-18 14:56 ` george at gly dot bris dot ac dot uk
2008-04-02  8:08 ` george at gcc dot gnu dot org
2008-08-29 18:43 ` jakub at gcc dot gnu dot org
2008-08-29 18:48 ` jakub at gcc dot gnu dot org
2005-07-25  5:41 [Bug fortran/23057] New: Wrong DWARF output for Fortran common block woodzltc at sources dot redhat dot com
2005-07-25  7:35 ` [Bug fortran/23057] Fortran common blocks are not described with DW_TAG_common_block pinskia at gcc dot gnu dot org
2005-08-03 20:21 ` howarth at nitro dot med dot uc dot edu
2005-08-03 20:25 ` pinskia at gcc dot gnu dot org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).