[PATCH] Fix loading of lto_section on strict alignment targets (PR lto/91078).

Richard Biener richard.guenther@gmail.com
Thu Jul 4 11:01:00 GMT 2019


On Thu, Jul 4, 2019 at 9:01 AM Martin Liška <mliska@suse.cz> wrote:
>
> Hi.
>
> The patch fixes wrong assignment from a char * to lto_section_header
> that is seen on strict alignment targets.
>
> I verified it fixes the problem with -fsanitize=undefined:
>
> gcc main.o -flto
> ../../gcc/lto/lto-common.c:2202:36: runtime error: reference binding to misaligned address 0x7f64dac090a7 for type 'const struct lto_section', which requires 4 byte alignment
> 0x7f64dac090a7: note: pointer points here
>  00 1b c0 02 09  00 00 00 03 00 00 00 28  b5 2f fd 60 77 00 d5 08  00 e6 d1 3d 37 20 01 09  00 bf 53
>              ^
> ../../gcc/lto/lto-common.c:2202:33: runtime error: load of misaligned address 0x7f64dac090a7 for type 'const struct lto_section', which requires 4 byte alignment
> 0x7f64dac090a7: note: pointer points here
>  00 1b c0 02 09  00 00 00 03 00 00 00 28  b5 2f fd 60 77 00 d5 08  00 e6 d1 3d 37 20 01 09  00 bf 53
>              ^
>
> Ready for trunk?

OK.

> Thanks,
> Martin
>
> gcc/lto/ChangeLog:
>
> 2019-07-04  Martin Liska  <mliska@suse.cz>
>
>         PR lto/91078
>         * lto-common.c (lto_file_finalize): Use memcpy to set
>         file_data->lto_section_header.
> ---
>  gcc/lto/lto-common.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
>



More information about the Gcc-patches mailing list