From 302e9fd31d51226850543a66d9112917de4c37d4 Mon Sep 17 00:00:00 2001 From: jakub Date: Sun, 31 Aug 2008 11:23:04 +0000 Subject: [PATCH] PR debug/37287 * dwarf2out.c (gen_namespace_die): For DECL_EXTERNAL modules don't add source coords. * gfortran.dg/pr37287-1.f90: New test. * gfortran.dg/pr37287-2.F90: New test. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@139826 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 4 ++++ gcc/dwarf2out.c | 8 ++++++-- gcc/testsuite/ChangeLog | 6 ++++++ gcc/testsuite/gfortran.dg/pr37287-1.f90 | 16 ++++++++++++++++ gcc/testsuite/gfortran.dg/pr37287-2.F90 | 10 ++++++++++ 5 files changed, 42 insertions(+), 2 deletions(-) create mode 100644 gcc/testsuite/gfortran.dg/pr37287-1.f90 create mode 100644 gcc/testsuite/gfortran.dg/pr37287-2.F90 diff --git a/gcc/ChangeLog b/gcc/ChangeLog index f78b208..11c0592 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,5 +1,9 @@ 2008-08-31 Jakub Jelinek + PR debug/37287 + * dwarf2out.c (gen_namespace_die): For DECL_EXTERNAL modules don't + add source coords. + * dwarf2out.c (native_encode_initializer): Subtract min_index for non-range array index. Handle VIEW_CONVERT_EXPR and NON_LVALUE_EXPR. diff --git a/gcc/dwarf2out.c b/gcc/dwarf2out.c index 6a8d34c..3e1bd5a 100644 --- a/gcc/dwarf2out.c +++ b/gcc/dwarf2out.c @@ -15036,11 +15036,15 @@ gen_namespace_die (tree decl) they are an alias of. */ if (DECL_ABSTRACT_ORIGIN (decl) == NULL) { - /* Output a real namespace. */ + /* Output a real namespace or module. */ dw_die_ref namespace_die = new_die (is_fortran () ? DW_TAG_module : DW_TAG_namespace, context_die, decl); - add_name_and_src_coords_attributes (namespace_die, decl); + /* For Fortran modules defined in different CU don't add src coords. */ + if (namespace_die->die_tag == DW_TAG_module && DECL_EXTERNAL (decl)) + add_name_attribute (namespace_die, dwarf2_name (decl, 0)); + else + add_name_and_src_coords_attributes (namespace_die, decl); if (DECL_EXTERNAL (decl)) add_AT_flag (namespace_die, DW_AT_declaration, 1); equate_decl_number_to_die (decl, namespace_die); diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 647714a..7e855c6 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,9 @@ +2008-08-31 Jakub Jelinek + + PR debug/37287 + * gfortran.dg/pr37287-1.f90: New test. + * gfortran.dg/pr37287-2.F90: New test. + 2008-08-31 Daniel Kraft * gfortran.dg/typebound_generic_1.f03: New test. diff --git a/gcc/testsuite/gfortran.dg/pr37287-1.f90 b/gcc/testsuite/gfortran.dg/pr37287-1.f90 new file mode 100644 index 0000000..629966f --- /dev/null +++ b/gcc/testsuite/gfortran.dg/pr37287-1.f90 @@ -0,0 +1,16 @@ +! PR debug/37287 +! { dg-do link } +! { dg-options "-g -DPR37287_1" } +! { dg-additional-sources pr37287-2.F90 } +module pr37287_1 + use iso_c_binding, only : c_ptr, c_associated, c_null_ptr + implicit none +contains + subroutine set_null(ptr) + type(c_ptr), intent(out) :: ptr + ptr = c_null_ptr + end subroutine set_null +end module pr37287_1 +end +! { dg-final { cleanup-modules "pr37287_1" } } +! { dg-final { cleanup-modules "pr37287_2" } } diff --git a/gcc/testsuite/gfortran.dg/pr37287-2.F90 b/gcc/testsuite/gfortran.dg/pr37287-2.F90 new file mode 100644 index 0000000..330ab42 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/pr37287-2.F90 @@ -0,0 +1,10 @@ +! PR debug/37287 +! { dg-do compile } +! { dg-options "-g" } +module pr37287_2 +#ifdef PR37287_1 + use pr37287_1 +#endif + implicit none +end module pr37287_2 +! { dg-final { cleanup-modules "pr37287_2" } } -- 2.7.4