aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexandre Oliva <aoliva@gcc.gnu.org>2005-04-02 17:08:07 +0000
committerAlexandre Oliva <aoliva@gcc.gnu.org>2005-04-02 17:08:07 +0000
commit596b98ceab6f7072c54e542694a80774fb294949 (patch)
tree91913620b789051aec1d96f7ad92a37fce830aeb
parente18d4a1904df31796cd4f10df5fb44fa9ef68d17 (diff)
downloadgcc-596b98ceab6f7072c54e542694a80774fb294949.zip
gcc-596b98ceab6f7072c54e542694a80774fb294949.tar.gz
gcc-596b98ceab6f7072c54e542694a80774fb294949.tar.bz2
re PR debug/19345 (Segmentation fault with VLA and inlining and dwarf2)
gcc/ChangeLog: PR debug/19345 * dwarf2out.c (add_abstract_origin_attribute): Revert accidental change checked in along with 2005-03-03's patch for debug/20253. * tree-inline.c (remap_type): Remap TYPE_STUB_DECL. (remap_decl): Insert type decl in map earlier. gcc/testsuite/ChangeLog: * gcc.dg/pr19345.c: New test. From-SVN: r97449
-rw-r--r--gcc/ChangeLog8
-rw-r--r--gcc/dwarf2out.c6
-rw-r--r--gcc/testsuite/ChangeLog4
-rw-r--r--gcc/testsuite/gcc.dg/pr19345.c12
-rw-r--r--gcc/tree-inline.c11
5 files changed, 33 insertions, 8 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 3cb960e..f158331 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,5 +1,13 @@
2005-04-02 Alexandre Oliva <aoliva@redhat.com>
+ PR debug/19345
+ * dwarf2out.c (add_abstract_origin_attribute): Revert accidental
+ change checked in along with 2005-03-03's patch for debug/20253.
+ * tree-inline.c (remap_type): Remap TYPE_STUB_DECL.
+ (remap_decl): Insert type decl in map earlier.
+
+2005-04-02 Alexandre Oliva <aoliva@redhat.com>
+
PR tree-optimization/20640
* tree-ssa-dce.c (remove_dead_stmt): Don't redirect edge to
post-dominator if it has phi nodes.
diff --git a/gcc/dwarf2out.c b/gcc/dwarf2out.c
index bf76113..6b08ab6 100644
--- a/gcc/dwarf2out.c
+++ b/gcc/dwarf2out.c
@@ -10568,11 +10568,7 @@ add_abstract_origin_attribute (dw_die_ref die, tree origin)
if (TYPE_P (fn))
fn = TYPE_STUB_DECL (fn);
- /* TYPE_STUB_DECL may have given us a NULL, which decl_function_context
- won't like. */
- if (fn)
- fn = decl_function_context (fn);
-
+ fn = decl_function_context (fn);
if (fn)
dwarf2out_abstract_function (fn);
}
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 1264cf7..2b3c2ce 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,7 @@
+2005-04-02 Daniel Berlin <dberlin@dberlin.org>
+
+ * gcc.dg/pr19345.c: New test.
+
2005-04-02 Alexandre Oliva <aoliva@redhat.com>
PR tree-optimization/20640
diff --git a/gcc/testsuite/gcc.dg/pr19345.c b/gcc/testsuite/gcc.dg/pr19345.c
new file mode 100644
index 0000000..40c6de4
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr19345.c
@@ -0,0 +1,12 @@
+/* We shouldn't crash trying to produce the inlined structure type die debug info. */
+/* { dg-do compile } */
+/* { dg-options "-O1 -g" } */
+inline void bar(char a[], unsigned int l)
+{
+ asm volatile ("" :: "m" ( *(struct {char x[l]; } *)a));
+}
+
+void foo(void)
+{
+ bar (0, 0);
+}
diff --git a/gcc/tree-inline.c b/gcc/tree-inline.c
index ef284a1..59a2d72 100644
--- a/gcc/tree-inline.c
+++ b/gcc/tree-inline.c
@@ -172,6 +172,11 @@ remap_decl (tree decl, inline_data *id)
/* Make a copy of the variable or label. */
tree t = copy_decl_for_inlining (decl, fn, VARRAY_TREE (id->fns, 0));
+ /* Remember it, so that if we encounter this local entity again
+ we can reuse this copy. Do this early because remap_type may
+ need this decl for TYPE_STUB_DECL. */
+ insert_decl_map (id, decl, t);
+
/* Remap types, if necessary. */
TREE_TYPE (t) = remap_type (TREE_TYPE (t), id);
if (TREE_CODE (t) == TYPE_DECL)
@@ -214,9 +219,6 @@ remap_decl (tree decl, inline_data *id)
}
#endif
- /* Remember it, so that if we encounter this local entity
- again we can reuse this copy. */
- insert_decl_map (id, decl, t);
return t;
}
@@ -285,6 +287,9 @@ remap_type (tree type, inline_data *id)
TYPE_NEXT_VARIANT (new) = NULL;
}
+ if (TYPE_STUB_DECL (type))
+ TYPE_STUB_DECL (new) = remap_decl (TYPE_STUB_DECL (type), id);
+
/* Lazily create pointer and reference types. */
TYPE_POINTER_TO (new) = NULL;
TYPE_REFERENCE_TO (new) = NULL;