2008-08-31 Jakub Jelinek <jakub@redhat.com>
+ 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.
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);
+2008-08-31 Jakub Jelinek <jakub@redhat.com>
+
+ PR debug/37287
+ * gfortran.dg/pr37287-1.f90: New test.
+ * gfortran.dg/pr37287-2.F90: New test.
+
2008-08-31 Daniel Kraft <d@domob.eu>
* gfortran.dg/typebound_generic_1.f03: New test.
--- /dev/null
+! 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" } }
--- /dev/null
+! 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" } }