gcc.c (eval_spec_function): Finalize/restore the current string obstack state as part of the context...
* gcc.c (eval_spec_function): Finalize/restore the current string obstack state as part of the context push/pop operations. From-SVN: r187146
This commit is contained in:
parent
b075f09963
commit
b50ff8bbb3
|
@ -1,3 +1,8 @@
|
|||
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
|
||||
|
|
17
gcc/gcc.c
17
gcc/gcc.c
|
@ -5313,6 +5313,8 @@ eval_spec_function (const char *func, const char *args)
|
|||
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)
|
||||
|
@ -5329,6 +5331,18 @@ eval_spec_function (const char *func, const char *args)
|
|||
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. */
|
||||
|
||||
|
@ -5354,6 +5368,9 @@ eval_spec_function (const char *func, const char *args)
|
|||
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;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue