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  5:48 ` [Bug fortran/23057] " pinskia at gcc dot gnu dot org
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ 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] 5+ messages in thread

* [Bug fortran/23057] Wrong DWARF output for Fortran common block
  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  5:48 ` pinskia at gcc dot gnu dot org
  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 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-07-25  5:48 UTC (permalink / raw)
  To: gcc-bugs



-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |wrong-debug


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


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

* [Bug fortran/23057] Fortran common blocks are not described with DW_TAG_common_block
  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  5:48 ` [Bug fortran/23057] " pinskia at gcc dot gnu dot org
@ 2005-07-25  7:35 ` 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
  3 siblings, 0 replies; 5+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-07-25  7:35 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2005-07-25 05:48 -------
Confiremd, since the standard says "may", this is an enhancement.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
           Severity|normal                      |enhancement
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|                            |1
   Last reconfirmed|0000-00-00 00:00:00         |2005-07-25 05:48:05
               date|                            |
            Summary|Wrong DWARF output for      |Fortran common blocks are
                   |Fortran common block        |not described with
                   |                            |DW_TAG_common_block


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


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

* [Bug fortran/23057] Fortran common blocks are not described with DW_TAG_common_block
  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  5:48 ` [Bug fortran/23057] " pinskia at gcc dot gnu dot org
  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
  3 siblings, 0 replies; 5+ messages in thread
From: howarth at nitro dot med dot uc dot edu @ 2005-08-03 20:21 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From howarth at nitro dot med dot uc dot edu  2005-08-03 20:21 -------
Andrew,
     Do you think you might be interested in tackling the implementation of the
DW_TAG_common_block tag if we could get HJ Lu and/or Jakub Jelinek to provide
technical assistance? Having the ability to debug COMMON blocks in gfortran would
be quite helpful for programs like xplor-nih that heavily use them.
                   Jack

-- 


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


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

* [Bug fortran/23057] Fortran common blocks are not described with DW_TAG_common_block
  2005-07-25  5:41 [Bug fortran/23057] New: Wrong DWARF output for Fortran common block woodzltc at sources dot redhat dot com
                   ` (2 preceding siblings ...)
  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
  3 siblings, 0 replies; 5+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-08-03 20:25 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2005-08-03 20:25 -------
(In reply to comment #2)
Jack,
Actually on ppc-darwin, GCC still uses stabs so I doubt this is the bug you are hitting.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |howarth at nitro dot med dot
                   |                            |uc dot edu


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


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

end of thread, other threads:[~2005-08-03 20:25 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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  5:48 ` [Bug fortran/23057] " pinskia at gcc dot gnu dot org
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).