aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorRichard Henderson <rth@redhat.com>2004-12-19 13:08:33 -0800
committerRichard Henderson <rth@gcc.gnu.org>2004-12-19 13:08:33 -0800
commitcd801ba16686d649dece10ca44a9167872397e1d (patch)
tree6527e524281c131665bd6c6a7f833615dee15251 /gcc
parent199db659d0af9e43608fee9862ede41658f2ca52 (diff)
downloadgcc-cd801ba16686d649dece10ca44a9167872397e1d.zip
gcc-cd801ba16686d649dece10ca44a9167872397e1d.tar.gz
gcc-cd801ba16686d649dece10ca44a9167872397e1d.tar.bz2
re PR tree-optimization/18067 (ICE at loc_descriptor_from_tree_1 in dwarf2out.c (VLA) with const int.)
PR 18067 * stor-layout.c (variable_size): Force creation of a SAVE_EXPR. From-SVN: r92389
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog5
-rw-r--r--gcc/stor-layout.c10
-rw-r--r--gcc/testsuite/gcc.dg/debug/20041219-1.c8
3 files changed, 22 insertions, 1 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index c3ee48f..cf2c8f5 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,8 @@
+2004-12-19 Richard Henderson <rth@redhat.com>
+
+ PR 18067
+ * stor-layout.c (variable_size): Force creation of a SAVE_EXPR.
+
2003-12-19 Steven Bosscher <stevenb@suse.de>
* config/i386/i386.c (ix86_split_to_parts): Use an array with
diff --git a/gcc/stor-layout.c b/gcc/stor-layout.c
index 6b78fa6..7069ad9 100644
--- a/gcc/stor-layout.c
+++ b/gcc/stor-layout.c
@@ -125,11 +125,19 @@ variable_size (tree size)
just return SIZE unchanged. Likewise for self-referential sizes and
constant sizes. */
if (TREE_CONSTANT (size)
+ || TREE_CODE (size) == SAVE_EXPR
|| lang_hooks.decls.global_bindings_p () < 0
|| CONTAINS_PLACEHOLDER_P (size))
return size;
- size = save_expr (size);
+ /* Force creation of a SAVE_EXPR. This solves (1) code duplication
+ problems between parent and nested functions that occasionally can't
+ be cleaned up because of portions of the expression escaping the
+ parent function via the FRAME object, and (2) tree sharing problems
+ between the type system and the gimple code, which can leak SSA_NAME
+ objects into e.g. TYPE_SIZE, which cause heartburn when emitting
+ debug information. */
+ size = build1 (SAVE_EXPR, TREE_TYPE (size), size);
/* If an array with a variable number of elements is declared, and
the elements require destruction, we will emit a cleanup for the
diff --git a/gcc/testsuite/gcc.dg/debug/20041219-1.c b/gcc/testsuite/gcc.dg/debug/20041219-1.c
new file mode 100644
index 0000000..6a62bb9
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/debug/20041219-1.c
@@ -0,0 +1,8 @@
+/* PR 18067 */
+/* { dg-do compile } */
+
+void foo(int i)
+{
+ const int j=i+1;
+ int a[1][j*j];
+}