* [Qemu-devel] [PATCH] target/ppc: fix build on ppc64 host
@ 2018-07-04 18:38 Laurent Vivier
2018-07-04 22:19 ` Richard Henderson
2018-07-05 0:16 ` David Gibson
0 siblings, 2 replies; 3+ messages in thread
From: Laurent Vivier @ 2018-07-04 18:38 UTC (permalink / raw)
To: qemu-devel
Cc: Dr . David Alan Gilbert, qemu-ppc, David Gibson, Laurent Vivier
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 <dgilbert@redhat.com>
Signed-off-by: Laurent Vivier <laurent@vivier.eu>
---
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
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [Qemu-devel] [PATCH] target/ppc: fix build on ppc64 host
2018-07-04 18:38 [Qemu-devel] [PATCH] target/ppc: fix build on ppc64 host Laurent Vivier
@ 2018-07-04 22:19 ` Richard Henderson
2018-07-05 0:16 ` David Gibson
1 sibling, 0 replies; 3+ messages in thread
From: Richard Henderson @ 2018-07-04 22:19 UTC (permalink / raw)
To: Laurent Vivier, qemu-devel
Cc: qemu-ppc, Dr . David Alan Gilbert, David Gibson
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 <dgilbert@redhat.com>
> Signed-off-by: Laurent Vivier <laurent@vivier.eu>
> ---
> target/ppc/int_helper.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
r~
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [Qemu-devel] [PATCH] target/ppc: fix build on ppc64 host
2018-07-04 18:38 [Qemu-devel] [PATCH] target/ppc: fix build on ppc64 host Laurent Vivier
2018-07-04 22:19 ` Richard Henderson
@ 2018-07-05 0:16 ` David Gibson
1 sibling, 0 replies; 3+ messages in thread
From: David Gibson @ 2018-07-05 0:16 UTC (permalink / raw)
To: Laurent Vivier; +Cc: qemu-devel, Dr . David Alan Gilbert, qemu-ppc
[-- Attachment #1: Type: text/plain, Size: 2019 bytes --]
On Wed, Jul 04, 2018 at 08:38:55PM +0200, Laurent Vivier wrote:
1;5202;0c> 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 <dgilbert@redhat.com>
> Signed-off-by: Laurent Vivier <laurent@vivier.eu>
Applied to ppc-for-3.0, thanks.
> ---
> 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
--
David Gibson | I'll have my music baroque, and my code
david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_
| _way_ _around_!
http://www.ozlabs.org/~dgibson
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2018-07-05 0:42 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-07-04 18:38 [Qemu-devel] [PATCH] target/ppc: fix build on ppc64 host Laurent Vivier
2018-07-04 22:19 ` Richard Henderson
2018-07-05 0:16 ` David Gibson
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).