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

Rainer Orth ro@CeBiTec.Uni-Bielefeld.DE
Thu Jul 4 10:28:00 GMT 2019


Hi Martin,

> 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?

I've just tested the patch on sparc-sun-solaris2.11: testsuite results
are back to normal again.

Thanks.
        Rainer

-- 
-----------------------------------------------------------------------------
Rainer Orth, Center for Biotechnology, Bielefeld University



More information about the Gcc-patches mailing list