From 70980ea225624d49591ae24262c55f2328517b62 Mon Sep 17 00:00:00 2001 From: Martin Liska Date: Thu, 4 Jul 2019 13:38:28 +0200 Subject: [PATCH] Fix loading of lto_section on strict alignment targets (PR lto/91078). 2019-07-04 Martin Liska PR lto/91078 * lto-common.c (lto_file_finalize): Use memcpy to set file_data->lto_section_header. From-SVN: r273077 --- gcc/lto/ChangeLog | 6 ++++++ gcc/lto/lto-common.c | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/gcc/lto/ChangeLog b/gcc/lto/ChangeLog index 23ad84ecc75..871598cae51 100644 --- a/gcc/lto/ChangeLog +++ b/gcc/lto/ChangeLog @@ -1,3 +1,9 @@ +2019-07-04 Martin Liska + + PR lto/91078 + * lto-common.c (lto_file_finalize): Use memcpy to set + file_data->lto_section_header. + 2019-07-03 Martin Liska * lto-common.c: Read LTO section and verify header. diff --git a/gcc/lto/lto-common.c b/gcc/lto/lto-common.c index bc8c2b40387..3c6d7b25ddb 100644 --- a/gcc/lto/lto-common.c +++ b/gcc/lto/lto-common.c @@ -2199,7 +2199,7 @@ lto_file_finalize (struct lto_file_decl_data *file_data, lto_file *file) return; } - file_data->lto_section_header = *(const lto_section *)data; + memcpy (&file_data->lto_section_header, data, sizeof (lto_section)); lto_check_version (file_data->lto_section_header.major_version, file_data->lto_section_header.minor_version, file_data->file_name); -- 2.30.2