This is the mail archive of the mailing list for the GCC project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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?


	PR middle-end/29299
	* cfgexpand.c (expand_used_vars_for_block): Vars marked used by user
	are used.

Index: cfgexpand.c
--- 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;

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]