From 1368453c6a59c0441fcf9fef79d1821a74a71565 Mon Sep 17 00:00:00 2001 From: Jan Hubicka Date: Wed, 18 Oct 2006 23:39:52 +0200 Subject: [PATCH] re PR middle-end/29299 (gcc "used" attribute has no effect on local-scope static variables) PR middle-end/29299 * cfgexpand.c (expand_used_vars_for_block): Vars marked used by user are used. From-SVN: r117863 --- gcc/ChangeLog | 6 ++++++ gcc/cfgexpand.c | 7 ++++++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 8b82507d1cb..b4ff9cf2adc 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2006-10-18 Jan Hubicka + + PR middle-end/29299 + * cfgexpand.c (expand_used_vars_for_block): Vars marked used by user + are used. + 2006-10-18 Marcin Dalecki * omp-low.c (expand_parallel_call): Use BSI_SAME_STMT instead of diff --git a/gcc/cfgexpand.c b/gcc/cfgexpand.c index 4cc1047fadf..b688917cc72 100644 --- a/gcc/cfgexpand.c +++ b/gcc/cfgexpand.c @@ -764,7 +764,12 @@ expand_used_vars_for_block (tree block, bool toplevel) /* Expand all variables at this level. */ for (t = BLOCK_VARS (block); t ; t = TREE_CHAIN (t)) - if (TREE_USED (t)) + if (TREE_USED (t) + /* Force local static variables to be output when marked by + used attribute. For unit-at-a-time, cgraph code already takes + care of this. */ + || (!flag_unit_at_a_time && TREE_STATIC (t) + && DECL_PRESERVE_P (t))) expand_one_var (t, toplevel); this_sv_num = stack_vars_num; -- 2.30.2