+2012-05-04 Olivier Hainque <hainque@adacore.com>
+
+ * gcc.c (eval_spec_function): Finalize/restore the current string
+ obstack state as part of the context push/pop operations.
+
2012-05-04 Bin Cheng <bin.cheng@arm.com>
PR rtl-optimization/52804
int save_this_is_linker_script;
const char *save_suffix_subst;
+ int save_growing_size;
+ void *save_growing_value;
sf = lookup_spec_function (func);
if (sf == NULL)
save_input_from_pipe = input_from_pipe;
save_suffix_subst = suffix_subst;
+ /* If we have some object growing now, finalize it so the args and function
+ eval proceed from a cleared context. This is needed to prevent the first
+ constructed arg from mistakenly including the growing value. We'll push
+ this value back on the obstack once the function evaluation is done, to
+ restore a consistent processing context for our caller. This is fine as
+ the address of growing objects isn't guaranteed to remain stable until
+ they are finalized, and we expect this situation to be rare enough for
+ the extra copy not to be an issue. */
+ save_growing_size = obstack_object_size (&obstack);
+ if (save_growing_size > 0)
+ save_growing_value = obstack_finish (&obstack);
+
/* Create a new spec processing context, and build the function
arguments. */
input_from_pipe = save_input_from_pipe;
suffix_subst = save_suffix_subst;
+ if (save_growing_size > 0)
+ obstack_grow (&obstack, save_growing_value, save_growing_size);
+
return funcval;
}