From owner-freebsd-current@FreeBSD.ORG Tue Sep 18 17:09:55 2012 Return-Path: Delivered-To: current@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 9B667106566B for ; Tue, 18 Sep 2012 17:09:55 +0000 (UTC) (envelope-from jim.harris@gmail.com) Received: from mail-vb0-f54.google.com (mail-vb0-f54.google.com [209.85.212.54]) by mx1.freebsd.org (Postfix) with ESMTP id 4FBD28FC12 for ; Tue, 18 Sep 2012 17:09:55 +0000 (UTC) Received: by vbmv11 with SMTP id v11so129335vbm.13 for ; Tue, 18 Sep 2012 10:09:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:content-transfer-encoding; bh=XjdZz9O8OJTG7CUI282HDyrbJNoQIk14WYsMbhTJUEQ=; b=SUm+3f/vU55sltXoxqtxZDQ3glbLMm5yKbcpLbMuekS7BQgeweE7WeBL/yANjwZhB7 rvP6t0/9HKqrdICklU+Gc4ZodhWZV8Cjltu5PZD0pR/uyX6UkqwbOTopqqFXdQ1CPnc0 sjv/s6gfZ58W1K6F1nU02M7AdAxo3pOnjBfNNW3lcvl2cajy+DB2TTUzymAgifa/Zp/0 76NYJOQeKiWQyoXA0LaxcaxaSHnDaSyB4hqwIfwRIRwUg9sacaxb9jthbYgoihSM6Rbi YtVMCqLRmU5pZ2AKjnPsyn+X1zM9HgbW5UWiWKmzYE9aAvGxEDcK4RD3+5iSDyZ+CMXN 1fHw== MIME-Version: 1.0 Received: by 10.58.116.175 with SMTP id jx15mr387137veb.6.1347988194340; Tue, 18 Sep 2012 10:09:54 -0700 (PDT) Received: by 10.58.249.135 with HTTP; Tue, 18 Sep 2012 10:09:54 -0700 (PDT) In-Reply-To: <7BCCAFEA-693E-479A-B1BD-AAA625164DCC@gmail.com> References: <20120918125303.GN3357@albert.catwhisker.org> <7BCCAFEA-693E-479A-B1BD-AAA625164DCC@gmail.com> Date: Tue, 18 Sep 2012 10:09:54 -0700 Message-ID: From: Jim Harris To: Garrett Cooper Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Cc: "current@freebsd.org" Subject: Re: buildworld broke in sbin/nvmecontrol; r240620 suspected X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.5 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, 18 Sep 2012 17:09:55 -0000 On Tue, Sep 18, 2012 at 8:28 AM, Garrett Cooper wrote: > On Sep 18, 2012, at 5:53 AM, David Wolfskill wrote= : > >> This was on: >> >> FreeBSD g1-227.catwhisker.org 10.0-CURRENT FreeBSD 10.0-CURRENT #681 240= 597M: Mon Sep 17 15:34:41 PDT 2012 root@d134.dwolf.juniper.net.:/usr/ob= j/usr/src/sys/CANARY i386 >> >> using clang as the C compiler: >> >> ... >> =3D=3D=3D> sbin/nvmecontrol (all) >> clang -O2 -pipe -std=3Dgnu99 -Qunused-arguments -fstack-protector -Wsys= tem-headers -Werror -Wall -Wno-format-y2k -W -Wno-unused-parameter -Wstrict= -prototypes -Wmissing-prototypes -Wpointer-arith -Wreturn-type -Wcast-qual = -Wwrite-strings -Wswitch -Wshadow -Wunused-parameter -Wcast-align -Wchar-su= bscripts -Winline -Wnested-externs -Wredundant-decls -Wold-style-definition= -Wno-pointer-sign -Wno-empty-body -Wno-string-plus-int -c /usr/src/sbin/nv= mecontrol/nvmecontrol.c >> /usr/src/sbin/nvmecontrol/nvmecontrol.c:77:6: error: cast from 'struct n= vme_controller_data *' to 'uint32_t *' (aka 'unsigned int *') increases req= uired alignment from 1 to 4 [-Werror,-Wcast-align] >> p =3D (uint32_t *)cdata; >> ^~~~~~~~~~~~~~~~~ >> 1 error generated. >> *** [nvmecontrol.o] Error code 1 >> 1 error >> *** [all] Error code 2 >> 1 error >> *** [sbin.all__D] Error code 2 > > Probably should be using memcpy for that. > Thanks! > -Garrett I think adding __aligned(4) to struct nvme_controller_data is the better wa= y to go. This structure is already marked as __packed which seems to cause clang to think the structure could be unaligned. I've confirmed this fixes the issue. An an FYI - If I remove the __packed specifier (and do not add __aligned), clang compiles without nvmecontrol without warning as well. Regards, -Jim