summaryrefslogtreecommitdiff
path: root/gcc/lto-wrapper.c
diff options
context:
space:
mode:
authorrguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4>2011-10-26 11:48:09 +0000
committerrguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4>2011-10-26 11:48:09 +0000
commiteefcf076ad584a4dc4ea5a9b030fbcef2d7874dc (patch)
tree6dbae3ec7fb8969a6a36176743d3e9bd22099796 /gcc/lto-wrapper.c
parentde084923c2149f5d3a0eb35bee4b8b8e8b89cd66 (diff)
downloadgcc-eefcf076ad584a4dc4ea5a9b030fbcef2d7874dc.tar.gz
2011-10-26 Richard Guenther <rguenther@suse.de>
* lto-wrapper.c (run_gcc): Properly init/free obstack. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@180521 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/lto-wrapper.c')
-rw-r--r--gcc/lto-wrapper.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/gcc/lto-wrapper.c b/gcc/lto-wrapper.c
index f5f3dd24b45..f0a3cf3dce2 100644
--- a/gcc/lto-wrapper.c
+++ b/gcc/lto-wrapper.c
@@ -339,7 +339,6 @@ run_gcc (unsigned argc, char *argv[])
char *list_option_full = NULL;
const char *linker_output = NULL;
const char *collect_gcc, *collect_gcc_options;
- struct obstack env_obstack;
int parallel = 0;
int jobserver = 0;
bool no_partition = false;
@@ -517,11 +516,13 @@ run_gcc (unsigned argc, char *argv[])
{
FILE *stream = fopen (ltrans_output_file, "r");
FILE *mstream = NULL;
+ struct obstack env_obstack;
if (!stream)
fatal_perror ("fopen: %s", ltrans_output_file);
/* Parse the list of LTRANS inputs from the WPA stage. */
+ obstack_init (&env_obstack);
nr = 0;
for (;;)
{
@@ -574,7 +575,6 @@ cont:
/* Replace the .o suffix with a .ltrans.o suffix and write
the resulting name to the LTRANS output list. */
- obstack_init (&env_obstack);
obstack_grow (&env_obstack, input_name, strlen (input_name) - 2);
obstack_grow (&env_obstack, ".ltrans.o", sizeof (".ltrans.o"));
output_name = XOBFINISH (&env_obstack, char *);
@@ -654,9 +654,8 @@ cont:
free (output_names);
free (input_names);
free (list_option_full);
+ obstack_free (&env_obstack, NULL);
}
-
- obstack_free (&env_obstack, NULL);
}