From nobody Tue Nov 4 19:05:33 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1530729664121546.2476970940364; Wed, 4 Jul 2018 11:41:04 -0700 (PDT) Received: from localhost ([::1]:48811 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fami2-0000k8-3W for importer@patchew.org; Wed, 04 Jul 2018 14:40:58 -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+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" 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 184467440737095= 51608 is above array bounds of 'uint8_t[16]' {aka 'unsigned char[16]'} [-We= rror=3Darray-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 --=20 2.17.1