From owner-freebsd-current@freebsd.org Tue Aug 2 12:53:39 2016 Return-Path: Delivered-To: freebsd-current@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 868FABAC5A2 for ; Tue, 2 Aug 2016 12:53:39 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from citapm.icyb.net.ua (citapm.icyb.net.ua [212.40.38.140]) by mx1.freebsd.org (Postfix) with ESMTP id E2C2919B2 for ; Tue, 2 Aug 2016 12:53:38 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from porto.starpoint.kiev.ua (porto-e.starpoint.kiev.ua [212.40.38.100]) by citapm.icyb.net.ua (8.8.8p3/ICyb-2.3exp) with ESMTP id PAA11856 for ; Tue, 02 Aug 2016 15:53:31 +0300 (EEST) (envelope-from avg@FreeBSD.org) Received: from localhost ([127.0.0.1]) by porto.starpoint.kiev.ua with esmtp (Exim 4.34 (FreeBSD)) id 1bUZCN-000LhR-0o for freebsd-current@freebsd.org; Tue, 02 Aug 2016 15:53:31 +0300 To: FreeBSD Current From: Andriy Gapon Subject: amd64-xtoolchain-gcc: small kernel compilation issue Message-ID: <0889f99f-b6fd-3768-818e-5b4ca9788229@FreeBSD.org> Date: Tue, 2 Aug 2016 15:52:11 +0300 User-Agent: Mozilla/5.0 (Windows NT 6.3; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.2.0 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 02 Aug 2016 12:53:39 -0000 /usr/src/sys/modules/vmm/../../amd64/vmm/vmm_dev.c: In function 'alloc_memseg': /usr/src/sys/modules/vmm/../../amd64/vmm/vmm_dev.c:261:3: error: null argument where non-null required (argument 1) [-Werror=nonnull] error = copystr(VM_MEMSEG_NAME(mseg), name, SPECNAMELEN + 1, 0); This is with amd64-xtoolchain-gcc-0.1, which seems to install gcc version 5.3.0, and optimization level set to O1. It seems that in that case gcc is not smart enough to figure out that if VM_MEMSEG_NAME(mseg) is not NULL in a condition, then it can not be NULL in a block guarded by the condition. So, the following trivial patch should not be necessary but makes gcc a bit happier: --- a/sys/amd64/vmm/vmm_dev.c +++ b/sys/amd64/vmm/vmm_dev.c @@ -258,7 +258,7 @@ alloc_memseg if (VM_MEMSEG_NAME(mseg)) { sysmem = false; name = malloc(SPECNAMELEN + 1, M_VMMDEV, M_WAITOK); - error = copystr(VM_MEMSEG_NAME(mseg), name, SPECNAMELEN + 1, 0); + error = copystr(mseg->name, name, SPECNAMELEN + 1, 0); if (error) goto done; } -- Andriy Gapon