[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-ppc] [Qemu-devel] [PATCH] target/ppc: fix build on ppc64 host
From: |
Richard Henderson |
Subject: |
Re: [Qemu-ppc] [Qemu-devel] [PATCH] target/ppc: fix build on ppc64 host |
Date: |
Wed, 4 Jul 2018 15:19:56 -0700 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.8.0 |
On 07/04/2018 11:38 AM, Laurent Vivier wrote:
> When I try to build a ppc64 target on a ppc64 host (gcc 8.1.1), I have:
>
> .../target/ppc/int_helper.c: In function 'helper_vinsertb':
> .../target/ppc/int_helper.c:1954:32: error: array subscript
> 18446744073709551608 is above array bounds of 'uint8_t[16]' {aka 'unsigned
> char[16]'} [-Werror=array-bounds]
> memmove(&r->u8[index], &b->u8[8 - sizeof(r->element)], \
> ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> .../target/ppc/int_helper.c:1965:1: note: in expansion of macro 'VINSERT'
>
> If we compare with the macro for ppc64le, we can see
> sizeof(r->element[0]) should be used instead of sizeof(r->element).
>
> And VINSERT uses only u8, u16, u32 and u64, so the maximum value
> of sizeof(r->element[0]) is 8
>
> Suggested-by: Dr. David Alan Gilbert <address@hidden>
> Signed-off-by: Laurent Vivier <address@hidden>
> ---
> target/ppc/int_helper.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
Reviewed-by: Richard Henderson <address@hidden>
r~