re PR middle-end/29299 (gcc "used" attribute has no effect on local-scope static...
authorJan Hubicka <jh@suse.cz>
Wed, 18 Oct 2006 21:39:52 +0000 (23:39 +0200)
committerJan Hubicka <hubicka@gcc.gnu.org>
Wed, 18 Oct 2006 21:39:52 +0000 (21:39 +0000)
PR middle-end/29299
* cfgexpand.c (expand_used_vars_for_block): Vars marked used by user
are used.

From-SVN: r117863

gcc/ChangeLog
gcc/cfgexpand.c

index 8b82507d1cb5646342997fe0a251a7c168af81b6..b4ff9cf2adcc23d2bc7696f18ffeb3e8cfc36679 100644 (file)
@@ -1,3 +1,9 @@
+2006-10-18  Jan Hubicka  <jh@suse.cz>
+
+       PR middle-end/29299
+       * cfgexpand.c (expand_used_vars_for_block): Vars marked used by user
+       are used.
+
 2006-10-18  Marcin Dalecki  <martin@dalecki.de>
 
        * omp-low.c (expand_parallel_call): Use BSI_SAME_STMT instead of
index 4cc1047fadfde045d1478ceb4f747c012a9f6c8c..b688917cc72b64823a221742b1009a2f15a4a400 100644 (file)
@@ -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;