Hi.

It's quite obvious fix where we ask for a compression algorithm
to file_data->lto_section_header which is unfilled.

Patch works with nvptx offloading compiler and lto.exp works fine
on x86_64-linux-gnu.

Ready to be installed?
Thanks,
Martin

gcc/lto/ChangeLog:

2020-04-17  Martin Liska  <mli...@suse.cz>

        PR lto/94612
        * lto-common.c: Initialize file_data->lto_section_header
        before lto_mode_identity_table call.  It is needed because
        it decompresses a LTO section.
---
 gcc/lto/lto-common.c | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)


diff --git a/gcc/lto/lto-common.c b/gcc/lto/lto-common.c
index e073abce2e7..cee5f0e9935 100644
--- a/gcc/lto/lto-common.c
+++ b/gcc/lto/lto-common.c
@@ -2197,11 +2197,6 @@ lto_file_finalize (struct lto_file_decl_data *file_data, lto_file *file,
   file_data->renaming_hash_table = lto_create_renaming_table ();
   file_data->file_name = file->filename;
   file_data->order = order;
-#ifdef ACCEL_COMPILER
-  lto_input_mode_table (file_data);
-#else
-  file_data->mode_table = lto_mode_identity_table;
-#endif
 
   /* Read and verify LTO section.  */
   data = lto_get_summary_section_data (file_data, LTO_section_lto, &len);
@@ -2217,6 +2212,12 @@ lto_file_finalize (struct lto_file_decl_data *file_data, lto_file *file,
 		     file_data->lto_section_header.minor_version,
 		     file_data->file_name);
 
+#ifdef ACCEL_COMPILER
+  lto_input_mode_table (file_data);
+#else
+  file_data->mode_table = lto_mode_identity_table;
+#endif
+
   data = lto_get_summary_section_data (file_data, LTO_section_decls, &len);
   if (data == NULL)
     {

Reply via email to