Patchwork [1/4] Don't crash when there are no options in a LTO file

login
register
mail settings
Submitter Andi Kleen
Date July 10, 2010, 11:41 a.m.
Message ID <20100710141.607682497@firstfloor.org>
Download mbox | patch
Permalink /patch/58477/
State New
Headers show

Comments

Andi Kleen - July 10, 2010, 11:41 a.m.
2010-07-10   Andi Kleen <ak@linux.intel.com>

	* lto-opts.c (lto_read_file_options): Check for missing section.

Patch

diff --git a/gcc/lto-opts.c b/gcc/lto-opts.c
index 8405714..fa52f95 100644
--- a/gcc/lto-opts.c
+++ b/gcc/lto-opts.c
@@ -356,6 +356,8 @@  lto_read_file_options (struct lto_file_decl_data *file_data)
   struct lto_input_block ib;
 
   data = lto_get_section_data (file_data, LTO_section_opts, NULL, &len);
+  if (!data)
+	  return;
   header = (const struct lto_simple_header *) data;
   opts_offset = sizeof (*header);