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; 10+ 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] 10+ 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; 10+ 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] 10+ 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; 10+ 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] 10+ 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; 10+ 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] 10+ 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; 10+ 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] 10+ messages in thread
* [Bug fortran/23057] Fortran common blocks are not described with DW_TAG_common_block
[not found] <bug-23057-10906@http.gcc.gnu.org/bugzilla/>
` (3 preceding siblings ...)
2008-08-29 18:43 ` jakub at gcc dot gnu dot org
@ 2008-08-29 18:48 ` jakub at gcc dot gnu dot org
4 siblings, 0 replies; 10+ messages in thread
From: jakub at gcc dot gnu dot org @ 2008-08-29 18:48 UTC (permalink / raw)
To: gcc-bugs
------- Comment #8 from jakub at gcc dot gnu dot org 2008-08-29 18:46 -------
Subject: Bug 23057
Author: jakub
Date: Fri Aug 29 18:45:25 2008
New Revision: 139775
URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=139775
Log:
PR fortran/23057
* dwarf2out.c (gen_variable_die): Represent Fortran COMMON vars
as DW_TAG_variable children of DW_TAG_common_block rather than
DW_TAG_member children. Put DW_AT_external to individual
DW_TAG_variable DIEs, not to DW_TAG_common_block.
* gfortran.dg/debug/pr35154-dwarf2.f: Adjust for replacement
of DW_TAG_member with DW_TAG_variable.
Modified:
trunk/gcc/ChangeLog
trunk/gcc/dwarf2out.c
trunk/gcc/testsuite/ChangeLog
trunk/gcc/testsuite/gfortran.dg/debug/pr35154-dwarf2.f
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=23057
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug fortran/23057] Fortran common blocks are not described with DW_TAG_common_block
[not found] <bug-23057-10906@http.gcc.gnu.org/bugzilla/>
` (2 preceding siblings ...)
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
4 siblings, 0 replies; 10+ messages in thread
From: jakub at gcc dot gnu dot org @ 2008-08-29 18:43 UTC (permalink / raw)
To: gcc-bugs
------- Comment #7 from jakub at gcc dot gnu dot org 2008-08-29 18:42 -------
Subject: Bug 23057
Author: jakub
Date: Fri Aug 29 18:41:19 2008
New Revision: 139773
URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=139773
Log:
PR fortran/29635
PR fortran/23057
* debug.h (struct gcc_debug_hooks): Add NAME and CHILD
arguments to imported_module_or_decl.
(debug_nothing_tree_tree): Removed.
(debug_nothing_tree_tree_tree_bool): New prototype.
* debug.c (do_nothing_debug_hooks): Adjust.
(debug_nothing_tree_tree): Removed.
(debug_nothing_tree_tree_tree_bool): New function.
* dwarf2out.c (is_symbol_die): Handle DW_TAG_module.
(gen_variable_die): Put all common vars for the
same COMMON block under one DW_TAG_common_block.
(declare_in_namespace): Return new context_die, for Fortran
return the module DIE instead of adding extra declarations into
the namespace.
(gen_type_die_with_usage): Adjust declare_in_namespace caller.
(gen_namespace_die): If is_fortran (), generate DW_TAG_module
instead of DW_TAG_namespace. If DECL_EXTERNAL is set, add
DW_AT_declaration.
(dwarf2out_global_decl): Don't skip Fortran global vars.
(gen_decl_die): Likewise. Adjust declare_in_namespace callers.
(dwarf2out_imported_module_or_decl): Add NAME and CHILD arguments.
If NAME is non-NULL, add DW_AT_name. If CHILD is non-NULL, put
DW_TAG_imported_declaration as child of previous
DW_TAG_imported_module.
* dbxout.c (dbx_debug_hooks, xcoff_debug_hooks): Adjust.
* sdbout.c (sdb_debug_hooks): Likewise.
* vmsdbgout.c (vmsdbg_debug_hooks): Likewise.
* name-lookup.c (do_using_directive, cp_emit_debug_info_for_using):
Adjust debug_hooks->imported_module_or_decl callers.
* f95-lang.c (gfc_init_ts): New function.
(LANG_HOOKS_INIT_TS): Define.
* gfortran.h (gfc_use_rename): New type, moved from module.c.
(gfc_get_use_rename): New macro, moved from module.c.
(gfc_use_list): New type.
(gfc_get_use_list): New macro.
(gfc_namespace): Add use_stmts field.
(gfc_free_use_stmts): New prototype.
* Make-lang.in (fortran/trans-decl.o): Depend on debug.h.
* module.c (gfc_use_rename, gfc_get_use_rename): Moved to
gfortran.h.
(gfc_use_module): Chain the USE statement info to
ns->use_stmts.
(gfc_free_use_stmts): New function.
* symbol.c (gfc_free_namespace): Call gfc_free_use_stmts.
* trans.h (struct module_htab_entry): New type.
(gfc_find_module, gfc_module_add_decl): New functions.
* trans.c (gfc_generate_module_code): Create NAMESPACE_DECL for
the module, adjust DECL_CONTEXTs of module procedures and
call gfc_module_add_decl for them.
* trans-common.c (build_common_decl): Set DECL_IGNORED_P
on the common variable.
(create_common): Set DECL_IGNORED_P for use associated vars.
* trans-decl.c: Include debug.h.
(gfc_get_symbol_decl): Set DECL_IGNORED_P on use_assoc vars from
modules.
(build_function_decl): Allow current_function_decl's context
to be a NAMESPACE_DECL.
(module_htab, cur_module): New variables.
(module_htab_do_hash, module_htab_eq, module_htab_decls_hash,
module_htab_decls_eq, gfc_find_module, gfc_module_add_decl): New
functions.
(gfc_create_module_variable): Adjust DECL_CONTEXTs of module
variables and types and call gfc_module_add_decl for them.
(gfc_generate_module_vars): Temporarily set cur_module.
(gfc_trans_use_stmts): New function.
(gfc_generate_function_code): Call it.
(gfc_generate_block_data): Set DECL_IGNORED_P on decl.
* trans-types.c (gfc_get_derived_type): Adjust DECL_CONTEXT
and TYPE_CONTEXT of module derived types.
Modified:
trunk/gcc/ChangeLog
trunk/gcc/cp/ChangeLog
trunk/gcc/cp/name-lookup.c
trunk/gcc/dbxout.c
trunk/gcc/debug.c
trunk/gcc/debug.h
trunk/gcc/dwarf2out.c
trunk/gcc/fortran/ChangeLog
trunk/gcc/fortran/Make-lang.in
trunk/gcc/fortran/f95-lang.c
trunk/gcc/fortran/gfortran.h
trunk/gcc/fortran/module.c
trunk/gcc/fortran/symbol.c
trunk/gcc/fortran/trans-common.c
trunk/gcc/fortran/trans-decl.c
trunk/gcc/fortran/trans-types.c
trunk/gcc/fortran/trans.c
trunk/gcc/fortran/trans.h
trunk/gcc/sdbout.c
trunk/gcc/vmsdbgout.c
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=23057
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug fortran/23057] Fortran common blocks are not described with DW_TAG_common_block
[not found] <bug-23057-10906@http.gcc.gnu.org/bugzilla/>
2007-10-28 14:24 ` 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
4 siblings, 0 replies; 10+ messages in thread
From: george at gcc dot gnu dot org @ 2008-04-02 8:08 UTC (permalink / raw)
To: gcc-bugs
------- Comment #6 from george at gcc dot gnu dot org 2008-04-02 08:08 -------
Fixed in rev 133800, 1 April 2008
--
george at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
Resolution| |FIXED
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=23057
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug fortran/23057] Fortran common blocks are not described with DW_TAG_common_block
[not found] <bug-23057-10906@http.gcc.gnu.org/bugzilla/>
2007-10-28 14:24 ` 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
` (2 subsequent siblings)
4 siblings, 0 replies; 10+ messages in thread
From: george at gly dot bris dot ac dot uk @ 2007-11-18 14:56 UTC (permalink / raw)
To: gcc-bugs
------- Comment #5 from george at gly dot bris dot ac dot uk 2007-11-18 14:56 -------
I submitted a patch that causes debug info for identifiers in COMMON to be
emitted with DW_TAG_common_block. See
http://gcc.gnu.org/ml/gcc-patches/2007-11/msg00311.html
--
george at gly dot bris dot ac dot uk changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |george at gly dot bris dot
| |ac dot uk
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=23057
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug fortran/23057] Fortran common blocks are not described with DW_TAG_common_block
[not found] <bug-23057-10906@http.gcc.gnu.org/bugzilla/>
@ 2007-10-28 14:24 ` fxcoudert at gcc dot gnu dot org
2007-11-18 14:56 ` george at gly dot bris dot ac dot uk
` (3 subsequent siblings)
4 siblings, 0 replies; 10+ messages in thread
From: fxcoudert at gcc dot gnu dot org @ 2007-10-28 14:24 UTC (permalink / raw)
To: gcc-bugs
------- Comment #4 from fxcoudert at gcc dot gnu dot org 2007-10-28 14:24 -------
Some more COMMON problems here:
http://gcc.gnu.org/ml/gcc-patches/2007-10/msg01685.html
--
fxcoudert at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |fxcoudert at gcc dot gnu dot
| |org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=23057
^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2008-08-29 18:48 UTC | newest]
Thread overview: 10+ 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
[not found] <bug-23057-10906@http.gcc.gnu.org/bugzilla/>
2007-10-28 14:24 ` 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
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).