This is the mail archive of the
mailing list for the GCC project.
- From: Jan Hubicka <jh at suse dot cz>
- To: gcc-patches at gcc dot gnu dot org
- Date: Wed, 18 Oct 2006 02:41:32 +0200
- Subject: PR middle-end/29299
this patch fix the other half of the problem with local static variables
marked used not being output to the file.
THe non-unit-at-a-time path expect cfgexpand.c to expand all local
statics that does not happen as we never mark TREE_USED flag for those.
I am not sure if just setting TREE_USED flag is not the desired
behavior, but probably the least intrusive way to fix this is to simply
check for the attribute there.
Bootstrapped/regtested i686-linux, OK?
* cfgexpand.c (expand_used_vars_for_block): Vars marked used by user
--- cfgexpand.c (revision 117745)
+++ cfgexpand.c (working copy)
@@ -764,7 +764,12 @@
/* 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;