{"id":808655,"url":"http://patchwork.ozlabs.org/api/1.0/covers/808655/?format=json","project":{"id":14,"url":"http://patchwork.ozlabs.org/api/1.0/projects/14/?format=json","name":"QEMU Development","link_name":"qemu-devel","list_id":"qemu-devel.nongnu.org","list_email":"qemu-devel@nongnu.org","web_url":"","scm_url":"","webscm_url":""},"msgid":"<20170901113438.12523-1-quintela@redhat.com>","date":"2017-09-01T11:34:36","name":"[v3,0/2] Fix tests on recent gcc","submitter":{"id":2643,"url":"http://patchwork.ozlabs.org/api/1.0/people/2643/?format=json","name":"Juan Quintela","email":"quintela@redhat.com"},"series":[{"id":1008,"url":"http://patchwork.ozlabs.org/api/1.0/series/1008/?format=json","date":"2017-09-01T11:34:37","name":"Fix tests on recent gcc","version":3,"mbox":"http://patchwork.ozlabs.org/series/1008/mbox/"}],"headers":{"Return-Path":"<qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>","X-Original-To":"incoming@patchwork.ozlabs.org","Delivered-To":"patchwork-incoming@bilbo.ozlabs.org","Authentication-Results":["ozlabs.org;\n\tspf=pass (mailfrom) smtp.mailfrom=nongnu.org\n\t(client-ip=2001:4830:134:3::11; helo=lists.gnu.org;\n\tenvelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org;\n\treceiver=<UNKNOWN>)","ext-mx04.extmail.prod.ext.phx2.redhat.com;\n\tdmarc=none (p=none dis=none) header.from=redhat.com","ext-mx04.extmail.prod.ext.phx2.redhat.com;\n\tspf=fail smtp.mailfrom=quintela@redhat.com"],"Received":["from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11])\n\t(using TLSv1 with cipher AES256-SHA (256/256 bits))\n\t(No client certificate requested)\n\tby ozlabs.org (Postfix) with ESMTPS id 3xkHQ54WVgz9sRV\n\tfor <incoming@patchwork.ozlabs.org>;\n\tFri,  1 Sep 2017 21:41:33 +1000 (AEST)","from localhost ([::1]:36470 helo=lists.gnu.org)\n\tby lists.gnu.org with esmtp (Exim 4.71) (envelope-from\n\t<qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>)\n\tid 1dnkKJ-0001Bu-Ic\n\tfor incoming@patchwork.ozlabs.org; Fri, 01 Sep 2017 07:41:31 -0400","from eggs.gnu.org ([2001:4830:134:3::10]:60608)\n\tby lists.gnu.org with esmtp (Exim 4.71)\n\t(envelope-from <quintela@redhat.com>) id 1dnkDp-0003bo-Gc\n\tfor qemu-devel@nongnu.org; Fri, 01 Sep 2017 07:34:54 -0400","from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)\n\t(envelope-from <quintela@redhat.com>) id 1dnkDk-0007gM-NQ\n\tfor qemu-devel@nongnu.org; Fri, 01 Sep 2017 07:34:49 -0400","from mx1.redhat.com ([209.132.183.28]:57144)\n\tby eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32)\n\t(Exim 4.71) (envelope-from <quintela@redhat.com>) id 1dnkDk-0007g1-Ey\n\tfor qemu-devel@nongnu.org; Fri, 01 Sep 2017 07:34:44 -0400","from smtp.corp.redhat.com\n\t(int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15])\n\t(using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))\n\t(No client certificate requested)\n\tby mx1.redhat.com (Postfix) with ESMTPS id 1A4007EA9B\n\tfor <qemu-devel@nongnu.org>; Fri,  1 Sep 2017 11:34:43 +0000 (UTC)","from secure.mitica (ovpn-117-188.ams2.redhat.com [10.36.117.188])\n\tby smtp.corp.redhat.com (Postfix) with ESMTP id CEBA7953DB;\n\tFri,  1 Sep 2017 11:34:39 +0000 (UTC)"],"DMARC-Filter":"OpenDMARC Filter v1.3.2 mx1.redhat.com 1A4007EA9B","From":"Juan Quintela <quintela@redhat.com>","To":"qemu-devel@nongnu.org","Date":"Fri,  1 Sep 2017 13:34:36 +0200","Message-Id":"<20170901113438.12523-1-quintela@redhat.com>","MIME-Version":"1.0","Content-Type":"text/plain; charset=UTF-8","X-Scanned-By":"MIMEDefang 2.79 on 10.5.11.15","X-Greylist":"Sender IP whitelisted, not delayed by milter-greylist-4.5.16\n\t(mx1.redhat.com [10.5.110.28]);\n\tFri, 01 Sep 2017 11:34:43 +0000 (UTC)","Content-Transfer-Encoding":"quoted-printable","X-detected-operating-system":"by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic]\n\t[fuzzy]","X-Received-From":"209.132.183.28","Subject":"[Qemu-devel] [PATCH v3 0/2] Fix tests on recent gcc","X-BeenThere":"qemu-devel@nongnu.org","X-Mailman-Version":"2.1.21","Precedence":"list","List-Id":"<qemu-devel.nongnu.org>","List-Unsubscribe":"<https://lists.nongnu.org/mailman/options/qemu-devel>,\n\t<mailto:qemu-devel-request@nongnu.org?subject=unsubscribe>","List-Archive":"<http://lists.nongnu.org/archive/html/qemu-devel/>","List-Post":"<mailto:qemu-devel@nongnu.org>","List-Help":"<mailto:qemu-devel-request@nongnu.org?subject=help>","List-Subscribe":"<https://lists.nongnu.org/mailman/listinfo/qemu-devel>,\n\t<mailto:qemu-devel-request@nongnu.org?subject=subscribe>","Cc":"lvivier@redhat.com, dgilbert@redhat.com, peterx@redhat.com","Errors-To":"qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org","Sender":"\"Qemu-devel\"\n\t<qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>"},"content":"Hi\n\nchanges from v2:\n- change assert from position\n\nPlease review.\n\n[v2]\n\n- move all uses of -1 for memtest.\n- remove docs about the feature.\n- use size_t for the second patch (cedric)\n\nPlease, review.\n\n\n[v1]\n\nOn Fedora 26 (gcc-7.1.1 and glib2 2.52.3) tests don't compile.\n\nIn file included from /usr/include/string.h:639:0,\n                 from /mnt/kvm/qemu/cleanup/include/qemu/osdep.h:69,\n                 from /mnt/kvm/qemu/cleanup/tests/test-iov.c:1:\nIn function ‘memcpy’,\n    inlined from ‘iov_from_buf’ at /mnt/kvm/qemu/cleanup/include/qemu/iov.h:51:9,\n    inlined from ‘test_to_from_buf_1’ at /mnt/kvm/qemu/cleanup/tests/test-iov.c:88:14,\n    inlined from ‘test_to_from_buf’ at /mnt/kvm/qemu/cleanup/tests/test-iov.c:144:9:\n/usr/include/bits/string3.h:53:10: error: ‘__builtin_memcpy’: specified size 18446744073709551615 exceeds maximum object size 9223372036854775807 [-Werror=stringop-overflow=]\n   return __builtin___memcpy_chk (__dest, __src, __len, __bos0 (__dest));\n          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\nIn function ‘memcpy’,\n    inlined from ‘iov_to_buf’ at /mnt/kvm/qemu/cleanup/include/qemu/iov.h:64:9,\n    inlined from ‘test_to_from_buf_1’ at /mnt/kvm/qemu/cleanup/tests/test-iov.c:94:14,\n    inlined from ‘test_to_from_buf’ at /mnt/kvm/qemu/cleanup/tests/test-iov.c:144:9:\n/usr/include/bits/string3.h:53:10: error: ‘__builtin_memcpy’: specified size 18446744073709551615 exceeds maximum object size 9223372036854775807 [-Werror=stringop-overflow=]\n   return __builtin___memcpy_chk (__dest, __src, __len, __bos0 (__dest));\n          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\ncc1: all warnings being treated as errors\n\nIn this case, we are abusing the functions and call a size_t argument\nwith -1, which gives us a very big number.  gcc gets overzealous and\ngets confused about it.  Notice that this was introduced in 2015 by Paolo:\n\ncommit ad523bca56a7202d2498c550a41be5c986c4d33c\nAuthor: Paolo Bonzini <pbonzini@redhat.com>\nDate:   Tue Dec 22 12:03:33 2015 +0100\n\n    iov: avoid memcpy for \"simple\" iov_from_buf/iov_to_buf\n\nI fixed it by using the real sizes in the tests insntead of -1.  It is already calculated.\n\n\n\n\nIn file included from /usr/include/glib-2.0/glib/glist.h:32:0,\n                 from /usr/include/glib-2.0/glib/ghash.h:33,\n                 from /usr/include/glib-2.0/glib.h:50,\n                 from /mnt/kvm/qemu/cleanup/tests/vmgenid-test.c:11:\nIn function ‘acpi_find_vgia’,\n    inlined from ‘read_guid_from_memory’ at /mnt/kvm/qemu/cleanup/tests/vmgenid-test.c:103:18:\n/usr/include/glib-2.0/glib/gmem.h:216:10: error: argument 1 range [18446744071562067968, 18446744073709551615] exceeds maximum object size 9223372036854775807 [-Werror=alloc-size-larger-than=]\n      __p = g_##func##_n (__n, __s);   \\\n      ~~~~^~~~~~~~~~~~~~~~~~~~~~~~~\n/usr/include/glib-2.0/glib/gmem.h:278:42: note: in expansion of macro ‘_G_NEW’\n #define g_new0(struct_type, n_structs)   _G_NEW (struct_type, n_structs, malloc0)\n                                          ^~~~~~\n/mnt/kvm/qemu/cleanup/tests/vmgenid-test.c:70:14: note: in expansion of macro ‘g_new0’\n     tables = g_new0(uint32_t, tables_nr);\n              ^~~~~~\n/mnt/kvm/qemu/cleanup/tests/vmgenid-test.c: In function ‘read_guid_from_memory’:\n/usr/include/glib-2.0/glib/gmem.h:96:10: note: in a call to allocation function ‘g_malloc0_n’ declared here\n gpointer g_malloc0_n      (gsize  n_blocks,\n          ^~~~~~~~~~~\ncc1: all warnings being treated as errors\nmake: *** [/mnt/kvm/qemu/cleanup/rules.mak:66: tests/vmgenid-test.o] Error 1\n\n\nthis cames form line:\n\n    tables = g_new0(uint32_t, tables_nr);\n\nglib/gcc gets completely confused about this and think that 1st\nargument can be 2^64-1.  Documentation says that you should use g_new\nfor struct types, so ...  I moved to g_malloc0() and call it a day.\n\nWhat do you think?\n\nLater, Juan.\n\nJuan Quintela (2):\n  tests: Use real size for iov tests\n  tests: Make vmgenid test compile\n\n include/qemu/iov.h   |  6 ------\n tests/test-iov.c     | 10 +++++-----\n tests/vmgenid-test.c |  2 +-\n 3 files changed, 6 insertions(+), 12 deletions(-)"}