From patchwork Wed Jul 4 18:38:55 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laurent Vivier X-Patchwork-Id: 939542 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=vivier.eu Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 41LVCs0kMWz9s52 for ; Thu, 5 Jul 2018 04:40:09 +1000 (AEST) Received: from localhost ([::1]:48801 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1famhC-0008Hs-ND for incoming@patchwork.ozlabs.org; Wed, 04 Jul 2018 14:40:06 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:45040) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1famgY-0008FW-Hs for qemu-devel@nongnu.org; Wed, 04 Jul 2018 14:39:27 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1famgV-0007Ck-Dp for qemu-devel@nongnu.org; Wed, 04 Jul 2018 14:39:26 -0400 Received: from mout.kundenserver.de ([212.227.17.24]:52815) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1famgV-0007AS-3M; Wed, 04 Jul 2018 14:39:23 -0400 Received: from localhost.localdomain ([78.238.229.36]) by mrelayeu.kundenserver.de (mreue101 [212.227.15.183]) with ESMTPSA (Nemesis) id 0MXYog-1feiY62Rba-00WVXC; Wed, 04 Jul 2018 20:39:16 +0200 From: Laurent Vivier To: qemu-devel@nongnu.org Date: Wed, 4 Jul 2018 20:38:55 +0200 Message-Id: <20180704183855.18304-1-laurent@vivier.eu> X-Mailer: git-send-email 2.17.1 X-Provags-ID: V03:K1:Mo77WS95IVnOHyy1JMEnSMwAVV7dbWwfIBg+re1TnOJsxwBxriI YzPjAd3vSM0IfjbvVi8J4gYh+wB5p/A0rp6njeUJY8HxChEfaM8cRGGczAGUcmmANQpgXgt 4u9M73Rl7biL9W77jIZq7RJBF5wDUfPVeBgqyxdkRVzG5RnFFSKUO+AXyn0I+lkLKziHaBy ymPruJPJiukVqL0rYAYZw== X-UI-Out-Filterresults: notjunk:1; V01:K0:zdVwDFYwElo=:z4LLFeUScr/es4KP7J6kPh y9YcnvmXI4hLhtrEwz3doxwEbE8kNQeuYj7CJWbpxMBPIToJGtOzirc6nG3iHYWAQ+h4+U9qc z6PcnvDL+g5ancib9sBP/0pY2sKE8MnAdLxp6B5+HWpN+5VIzpnlcNXGjRtBFm5zuqeuyWOfA I2FwkyrTnVdwQbW/kesXCoXNHwpbnyn0dlmUvoh3qCsQImJW9wiiIYEVx51TdmxFP7ASgDyOp RNoxJx0/+3cTxdG35rQm2jAW0TcQ6xtZBVmAJRHyrb7F5G+aTFVn3yCWI9E6BPFBk9yEPLSIP Fh3fiZf17MnXqUK+1fUyzZR+9nNg5ymAiWAn6LF4ULjfW/N9gWGomcwR6Wh9CqF0Z8fYtOMN2 CG3bZd2I01VZgHvCIPGae4EhfXyAnsIN7uIgI2DTwQPUO7rZ9jdyTahhbXApTmRAnkiXAbleF 5zThB4DRpxr1t0uSX9enrbb06YKpcK6NTf8GUGUZqJf0NEBYCoXBytkjcqNPZ9P0EEP7bwPTb 2jwkhS1G9+KVJQQthIQ+2H4crzohd1bswHiDA5nrAQGUwlDsyARwkqaM53nTJxtLgwGL8hTRY +zZJBbhjsnyXCn+yMiqjNsCjPeN84UFjM0eSeb+c7zBCAgb9rWPU15KBhTeO714raNaf46IWy tLx5RsseAPWHyc3PG+ZEZvLO4tsWR4fvADp32qvKMZVMw90ec44JZ7jyaO9TZhg6wqls= X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 212.227.17.24 Subject: [Qemu-devel] [PATCH] target/ppc: fix build on ppc64 host X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Laurent Vivier , qemu-ppc@nongnu.org, "Dr . David Alan Gilbert" , David Gibson Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" 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 Signed-off-by: Laurent Vivier Reviewed-by: Richard Henderson --- 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