Commit 4559db79 by Richard Guenther Committed by Richard Biener

lto-wrapper.c (run_gcc): Properly init/free obstack.

2011-10-26  Richard Guenther  <rguenther@suse.de>

	* lto-wrapper.c (run_gcc): Properly init/free obstack.

From-SVN: r180521
parent e43451aa
2011-10-26 Richard Guenther <rguenther@suse.de>
* lto-wrapper.c (run_gcc): Properly init/free obstack.
2011-10-26 Jakub Jelinek <jakub@redhat.com> 2011-10-26 Jakub Jelinek <jakub@redhat.com>
* config/i386/i386.md (UNSPEC_VSIBADDR): New. * config/i386/i386.md (UNSPEC_VSIBADDR): New.
...@@ -339,7 +339,6 @@ run_gcc (unsigned argc, char *argv[]) ...@@ -339,7 +339,6 @@ run_gcc (unsigned argc, char *argv[])
char *list_option_full = NULL; char *list_option_full = NULL;
const char *linker_output = NULL; const char *linker_output = NULL;
const char *collect_gcc, *collect_gcc_options; const char *collect_gcc, *collect_gcc_options;
struct obstack env_obstack;
int parallel = 0; int parallel = 0;
int jobserver = 0; int jobserver = 0;
bool no_partition = false; bool no_partition = false;
...@@ -517,11 +516,13 @@ run_gcc (unsigned argc, char *argv[]) ...@@ -517,11 +516,13 @@ run_gcc (unsigned argc, char *argv[])
{ {
FILE *stream = fopen (ltrans_output_file, "r"); FILE *stream = fopen (ltrans_output_file, "r");
FILE *mstream = NULL; FILE *mstream = NULL;
struct obstack env_obstack;
if (!stream) if (!stream)
fatal_perror ("fopen: %s", ltrans_output_file); fatal_perror ("fopen: %s", ltrans_output_file);
/* Parse the list of LTRANS inputs from the WPA stage. */ /* Parse the list of LTRANS inputs from the WPA stage. */
obstack_init (&env_obstack);
nr = 0; nr = 0;
for (;;) for (;;)
{ {
...@@ -574,7 +575,6 @@ cont: ...@@ -574,7 +575,6 @@ cont:
/* Replace the .o suffix with a .ltrans.o suffix and write /* Replace the .o suffix with a .ltrans.o suffix and write
the resulting name to the LTRANS output list. */ 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, input_name, strlen (input_name) - 2);
obstack_grow (&env_obstack, ".ltrans.o", sizeof (".ltrans.o")); obstack_grow (&env_obstack, ".ltrans.o", sizeof (".ltrans.o"));
output_name = XOBFINISH (&env_obstack, char *); output_name = XOBFINISH (&env_obstack, char *);
...@@ -654,9 +654,8 @@ cont: ...@@ -654,9 +654,8 @@ cont:
free (output_names); free (output_names);
free (input_names); free (input_names);
free (list_option_full); free (list_option_full);
obstack_free (&env_obstack, NULL);
} }
obstack_free (&env_obstack, NULL);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment