[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 11/16] target/ppc: fix build on ppc64 host
From: |
David Gibson |
Subject: |
[Qemu-devel] [PULL 11/16] target/ppc: fix build on ppc64 host |
Date: |
Mon, 9 Jul 2018 17:43:45 +1000 |
From: Laurent Vivier <address@hidden>
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>
Reviewed-by: Richard Henderson <address@hidden>
Signed-off-by: David Gibson <address@hidden>
---
target/ppc/int_helper.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/target/ppc/int_helper.c b/target/ppc/int_helper.c
index 03d37da79f..d52338ed71 100644
--- a/target/ppc/int_helper.c
+++ b/target/ppc/int_helper.c
@@ -1951,7 +1951,7 @@ VSPLT(w, u32)
#define VINSERT(suffix, element) \
void helper_vinsert##suffix(ppc_avr_t *r, ppc_avr_t *b, uint32_t index) \
{ \
- memmove(&r->u8[index], &b->u8[8 - sizeof(r->element)], \
+ memmove(&r->u8[index], &b->u8[8 - sizeof(r->element[0])], \
sizeof(r->element[0])); \
}
#else
--
2.17.1
- [Qemu-devel] [PULL 00/16] ppc-for-3.0 queue 20180709, David Gibson, 2018/07/09
- [Qemu-devel] [PULL 02/16] spapr/vio: quiet down the "irq" property accessors, David Gibson, 2018/07/09
- [Qemu-devel] [PULL 03/16] sm501: Implement i2c part for reading monitor EDID, David Gibson, 2018/07/09
- [Qemu-devel] [PULL 01/16] ppc: fix default VGA display for Mac machines, David Gibson, 2018/07/09
- [Qemu-devel] [PULL 11/16] target/ppc: fix build on ppc64 host,
David Gibson <=
- [Qemu-devel] [PULL 05/16] sm501: Use values from the pitch register for 2D operations, David Gibson, 2018/07/09
- [Qemu-devel] [PULL 04/16] sm501: Perform a full update after palette change, David Gibson, 2018/07/09
- [Qemu-devel] [PULL 09/16] sm501: Set updated region dirty after 2D operation, David Gibson, 2018/07/09
- [Qemu-devel] [PULL 08/16] sm501: Fix support for non-zero frame buffer start address, David Gibson, 2018/07/09
- [Qemu-devel] [PULL 16/16] sam460ex: Make sam460ex_load_device_tree() handle all errors internally, David Gibson, 2018/07/09
- [Qemu-devel] [PULL 15/16] sam460ex: Don't check for errors from qemu_fdt_*(), David Gibson, 2018/07/09
- [Qemu-devel] [PULL 07/16] sm501: Log unimplemented raster operation modes, David Gibson, 2018/07/09
- [Qemu-devel] [PULL 06/16] sm501: Implement negated destination raster operation mode, David Gibson, 2018/07/09
- [Qemu-devel] [PULL 13/16] sam460ex: Update u-boot-sam460ex firmware, David Gibson, 2018/07/09
- [Qemu-devel] [PULL 10/16] ppc440_uc: Fix a copy/paste error, David Gibson, 2018/07/09