summaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog14
-rw-r--r--gcc/cfgexpand.c28
-rw-r--r--gcc/function.c13
-rw-r--r--gcc/gimplify.c12
4 files changed, 61 insertions, 6 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 1b09bc4bada..4a6370563ba 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,15 @@
+2008-09-18 Jakub Jelinek <jakub@redhat.com>
+
+ PR debug/34037
+ * gimplify.c (gimplify_type_sizes): When not optimizing, ensure
+ TYPE_MIN_VALUE and TYPE_MAX_VALUE is not is not DECL_IGNORED_P
+ VAR_DECL.
+ * cfgexpand.c (expand_used_vars): Keep DECL_ARTIFICIAL
+ !DECL_IGNORED_P vars in local_decls list for instantiate_decls,
+ ggc_free other TREE_LIST nodes from that chain.
+ * function.c (instantiate_decls): Instantiate also DECL_RTL
+ of vars in cfun->local_decls, free that list afterwards.
+
2008-09-18 Eric Botcazou <ebotcazou@adacore.com>
* config/sparc/sol2.h (WIDEST_HARDWARE_FP_SIZE): Move to...
@@ -5,7 +17,7 @@
2008-09-18 Andrew MacLeod <amacleod@redhat.com>
- * tree-outof-ssa.c (eliminate_useless_phis): fix formatting.
+ * tree-outof-ssa.c (eliminate_useless_phis): Fix formatting.
* tree-flow-.h (struct immediate_use_iterator_d): Fix comment.
2008-09-18 Andrew MacLeod <amacleod@redhat.com>
diff --git a/gcc/cfgexpand.c b/gcc/cfgexpand.c
index d9e9835643b..06111cc85df 100644
--- a/gcc/cfgexpand.c
+++ b/gcc/cfgexpand.c
@@ -1440,7 +1440,7 @@ estimated_stack_frame_size (void)
static void
expand_used_vars (void)
{
- tree t, outer_block = DECL_INITIAL (current_function_decl);
+ tree t, next, outer_block = DECL_INITIAL (current_function_decl);
/* Compute the phase of the stack frame for this function. */
{
@@ -1453,11 +1453,15 @@ expand_used_vars (void)
/* At this point all variables on the local_decls with TREE_USED
set are not associated with any block scope. Lay them out. */
- for (t = cfun->local_decls; t; t = TREE_CHAIN (t))
+ t = cfun->local_decls;
+ cfun->local_decls = NULL_TREE;
+ for (; t; t = next)
{
tree var = TREE_VALUE (t);
bool expand_now = false;
+ next = TREE_CHAIN (t);
+
/* We didn't set a block for static or extern because it's hard
to tell the difference between a global variable (re)declared
in a local scope, and one that's really declared there to
@@ -1484,9 +1488,25 @@ expand_used_vars (void)
TREE_USED (var) = 1;
if (expand_now)
- expand_one_var (var, true, true);
+ {
+ expand_one_var (var, true, true);
+ if (DECL_ARTIFICIAL (var) && !DECL_IGNORED_P (var))
+ {
+ rtx rtl = DECL_RTL_IF_SET (var);
+
+ /* Keep artificial non-ignored vars in cfun->local_decls
+ chain until instantiate_decls. */
+ if (rtl && (MEM_P (rtl) || GET_CODE (rtl) == CONCAT))
+ {
+ TREE_CHAIN (t) = cfun->local_decls;
+ cfun->local_decls = t;
+ continue;
+ }
+ }
+ }
+
+ ggc_free (t);
}
- cfun->local_decls = NULL_TREE;
/* At this point, all variables within the block tree with TREE_USED
set are actually used by the optimized function. Lay them out. */
diff --git a/gcc/function.c b/gcc/function.c
index 41c5a46a621..08dc95a697c 100644
--- a/gcc/function.c
+++ b/gcc/function.c
@@ -1634,7 +1634,7 @@ instantiate_decls_1 (tree let)
static void
instantiate_decls (tree fndecl)
{
- tree decl;
+ tree decl, t, next;
/* Process all parameters of the function. */
for (decl = DECL_ARGUMENTS (fndecl); decl; decl = TREE_CHAIN (decl))
@@ -1650,6 +1650,17 @@ instantiate_decls (tree fndecl)
/* Now process all variables defined in the function or its subblocks. */
instantiate_decls_1 (DECL_INITIAL (fndecl));
+
+ t = cfun->local_decls;
+ cfun->local_decls = NULL_TREE;
+ for (; t; t = next)
+ {
+ next = TREE_CHAIN (t);
+ decl = TREE_VALUE (t);
+ if (DECL_RTL_SET_P (decl))
+ instantiate_decl_rtl (DECL_RTL (decl));
+ ggc_free (t);
+ }
}
/* Pass through the INSNS of function FNDECL and convert virtual register
diff --git a/gcc/gimplify.c b/gcc/gimplify.c
index bb38ba398f6..d723d9f16a9 100644
--- a/gcc/gimplify.c
+++ b/gcc/gimplify.c
@@ -7117,6 +7117,18 @@ gimplify_type_sizes (tree type, gimple_seq *list_p)
/* These types may not have declarations, so handle them here. */
gimplify_type_sizes (TREE_TYPE (type), list_p);
gimplify_type_sizes (TYPE_DOMAIN (type), list_p);
+ /* When not optimizing, ensure VLA bounds aren't removed. */
+ if (!optimize
+ && TYPE_DOMAIN (type)
+ && INTEGRAL_TYPE_P (TYPE_DOMAIN (type)))
+ {
+ t = TYPE_MIN_VALUE (TYPE_DOMAIN (type));
+ if (t && TREE_CODE (t) == VAR_DECL && DECL_ARTIFICIAL (t))
+ DECL_IGNORED_P (t) = 0;
+ t = TYPE_MAX_VALUE (TYPE_DOMAIN (type));
+ if (t && TREE_CODE (t) == VAR_DECL && DECL_ARTIFICIAL (t))
+ DECL_IGNORED_P (t) = 0;
+ }
break;
case RECORD_TYPE: