aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2008-08-31 13:23:04 +0200
committerJakub Jelinek <jakub@gcc.gnu.org>2008-08-31 13:23:04 +0200
commit8518c095a8aaa6375e1e7046c824d7c2a9893855 (patch)
treefe5f232d4f000ad440e632ec1ee70ebbbcbe88a0
parent08ab58b30f4ae0b42751ce52ac444691e6da2606 (diff)
downloadgcc-8518c095a8aaa6375e1e7046c824d7c2a9893855.zip
gcc-8518c095a8aaa6375e1e7046c824d7c2a9893855.tar.gz
gcc-8518c095a8aaa6375e1e7046c824d7c2a9893855.tar.bz2
re PR debug/37287 (ICE (segfault) with new debugging 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. From-SVN: r139826
-rw-r--r--gcc/ChangeLog4
-rw-r--r--gcc/dwarf2out.c8
-rw-r--r--gcc/testsuite/ChangeLog6
-rw-r--r--gcc/testsuite/gfortran.dg/pr37287-1.f9016
-rw-r--r--gcc/testsuite/gfortran.dg/pr37287-2.F9010
5 files changed, 42 insertions, 2 deletions
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 <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.
diff --git a/gcc/dwarf2out.c b/gcc/dwarf2out.c
index 6a8d34c..3e1bd5a6 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 <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.
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" } }