From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from list by lists.gnu.org with archive (Exim 4.71) id 1ZFe9z-0006hs-DT for mharc-grub-devel@gnu.org; Thu, 16 Jul 2015 04:04:51 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:47777) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZFe9w-0006gq-Pv for grub-devel@gnu.org; Thu, 16 Jul 2015 04:04:49 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZFe9v-0001SE-QX for grub-devel@gnu.org; Thu, 16 Jul 2015 04:04:48 -0400 Received: from mail-wg0-x22f.google.com ([2a00:1450:400c:c00::22f]:35389) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZFe9v-0001Re-HC for grub-devel@gnu.org; Thu, 16 Jul 2015 04:04:47 -0400 Received: by wgjx7 with SMTP id x7so51645934wgj.2 for ; Thu, 16 Jul 2015 01:04:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=message-id:date:from:user-agent:mime-version:to:cc:subject :references:in-reply-to:content-type; bh=2mBqTi+1dcexO2hPePPTz2wA4RIg601C+FdH6OkkUeY=; b=kGZ8Zkd4uMpgNVovaUZUs5UJtau6ngwWSp8GAGTUuIjPO0+4lh5VLtl46e8/7yZ2hx ZKWiCGn1n5sM5cKeNC+fhYcpLPP/UAMYB9VN81PHfeSk9xpXeAzP1Zf7Cqtv/HEaJ/tx bz+l5ep+PgnTFp5NWkcRs3uUzKaA5d/ZD3Ef7tu05UdJp4zK64rM/FuY9kLEq5aIC5I+ YXytqBOFCV1cZeRSa7wqRH8PnCAFdcREed/m0Dei0z+/mtlUl1b7gcMk3ZqIIWq7e8Zi thQk1YRywsQ8vf8z9SajoqM9/Pm+JkCzXVMN2pEsmKy+DLSdLV7mUBJy3iUznwet4rKC aFLw== X-Received: by 10.195.11.168 with SMTP id ej8mr16395557wjd.150.1437033886885; Thu, 16 Jul 2015 01:04:46 -0700 (PDT) Received: from ?IPv6:2a02:1205:34c8:dc00:863a:4bff:fe50:abc4? ([2a02:1205:34c8:dc00:863a:4bff:fe50:abc4]) by smtp.gmail.com with ESMTPSA id jz4sm11653234wjb.16.2015.07.16.01.04.45 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 16 Jul 2015 01:04:46 -0700 (PDT) Message-ID: <55A7659D.7080705@gmail.com> Date: Thu, 16 Jul 2015 10:04:45 +0200 From: =?UTF-8?B?VmxhZGltaXIgJ8+GLWNvZGVyL3BoY29kZXInIFNlcmJpbmVua28=?= User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Icedove/31.7.0 MIME-Version: 1.0 To: Andrei Borzenkov Subject: Re: [PATCH] zfs: fix compilation failure with clang due to alignment References: <1435950347-20073-1-git-send-email-arvidjaar@gmail.com> <55A6810A.60408@gmail.com> <20150716064630.466812fa@opensuse.site> In-Reply-To: <20150716064630.466812fa@opensuse.site> Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="LpaC1ma3q3000Pml8gqaulNAeeakNDTm8" X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2a00:1450:400c:c00::22f Cc: The development of GNU GRUB , jack@suse.cz X-BeenThere: grub-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list Reply-To: The development of GNU GRUB List-Id: The development of GNU GRUB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 16 Jul 2015 08:04:49 -0000 This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --LpaC1ma3q3000Pml8gqaulNAeeakNDTm8 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On 16.07.2015 05:46, Andrei Borzenkov wrote: > =D0=92 Wed, 15 Jul 2015 17:49:30 +0200 > Vladimir '=CF=86-coder/phcoder' Serbinenko =D0=BF=D0= =B8=D1=88=D0=B5=D1=82: >=20 >> >> On 03.07.2015 21:05, Andrei Borzenkov wrote: >>> I do not claim I understand why clang complains, but this patch does >>> fix it. >>> >>> fs/xfs.c:452:25: error: cast from 'struct grub_xfs_btree_node *' to >>> 'grub_uint64_t *' (aka 'unsigned long long *') increases requir= ed >>> alignment from 1 to 8 [-Werror,-Wcast-align] >>> grub_uint64_t *keys =3D (grub_uint64_t *)(leaf + 1); >>> ^~~~~~~~~~~~~~~~~~~~~~~~~~~ >>> 1 error generated. >>> >>> --- >>> >>> Jan, do you have any idea what's wrong and whether this is proper fix= ? >>> Or should I raise it with clang? >>> >>> grub-core/fs/xfs.c | 6 +++--- >>> 1 file changed, 3 insertions(+), 3 deletions(-) >>> >>> diff --git a/grub-core/fs/xfs.c b/grub-core/fs/xfs.c >>> index 7249291..ea8cf7e 100644 >>> --- a/grub-core/fs/xfs.c >>> +++ b/grub-core/fs/xfs.c >>> @@ -445,14 +445,14 @@ grub_xfs_next_de(struct grub_xfs_data *data, st= ruct grub_xfs_dir2_entry *de) >>> return (struct grub_xfs_dir2_entry *)(((char *)de) + ALIGN_UP(size= , 8)); >>> } >>> =20 >>> -static grub_uint64_t * >>> +static void * >>> grub_xfs_btree_keys(struct grub_xfs_data *data, >>> struct grub_xfs_btree_node *leaf) >>> { >>> - grub_uint64_t *keys =3D (grub_uint64_t *)(leaf + 1); >>> + char *keys =3D (char *)leaf + sizeof (*leaf); >>> =20 >>> if (data->hascrc) >>> - keys +=3D 6; /* skip crc, uuid, ... */ >>> + keys +=3D 6 * sizeof (grub_uint64_t); /* skip crc, uuid, ... */ >>> return keys; >>> } >>> =20 >> This would only hide the problem behind void*. Leif's patch solves the= >> problem. Another possibility is to analyze if packed is really require= d >> but most likely it is. >>> >> >> >=20 > grub_uint64_t is not really required at all. The whole code is used to > compute bite offset. So in reality this should simply be replaced by > char *. I would rather avoid making code even more complicated. >=20 > Jan, do I miss something? >=20 We have exactly the same problem at line 500: keys =3D &root->keys[0]; and root is in packed struct. I think it's better to solve both in the same way. --LpaC1ma3q3000Pml8gqaulNAeeakNDTm8 Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iF4EAREKAAYFAlWnZZ0ACgkQmBXlbbo5nOsy5wD+N7S8dXf+G9EZht7Vks2XBb26 ltJgzpqZN45SCRf65MUBAILWW5oh6jQbAJ9vfK0r4PRiPgXwgB4fmqu58WANcFel =06C3 -----END PGP SIGNATURE----- --LpaC1ma3q3000Pml8gqaulNAeeakNDTm8--