From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from list by lists.gnu.org with archive (Exim 4.71) id 1ZFa87-0003g8-56 for mharc-grub-devel@gnu.org; Wed, 15 Jul 2015 23:46:39 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:58946) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZFa84-0003g1-DZ for grub-devel@gnu.org; Wed, 15 Jul 2015 23:46:37 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZFa7z-000466-Dw for grub-devel@gnu.org; Wed, 15 Jul 2015 23:46:36 -0400 Received: from mail-la0-x229.google.com ([2a00:1450:4010:c03::229]:32879) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZFa7z-00045y-5N for grub-devel@gnu.org; Wed, 15 Jul 2015 23:46:31 -0400 Received: by laem6 with SMTP id m6so35978945lae.0 for ; Wed, 15 Jul 2015 20:46:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=date:from:to:cc:subject:message-id:in-reply-to:references :mime-version:content-type; bh=MDWKupYJMqi6i9UZ7q+qdRx8J3CJX1/0QDDg9YIYw1Q=; b=x1JoAysRBgoPobKogJKqEy15w2V8Kh7bfGz5OErah9KuZ5JYq4KDd/O5thcqQK3IoR c7xoXHMkOM6NQ86/G7+V7UIaIvhmw1NN1q9c45mnIgbhDygAwfUvw/Ule7y+bAfKHihn M7XxYbzmmsPCd4bhBzW/auBsLdxikaDDK2fE8FHZ7B1Cfur0OAy82aloH1we38niN65G pfMwxDOX5TVxTwvljSjPJqG+paDQdwS/FHq9TyW75JcgRs1nKhgyaJNpkPYlmIJXp3E5 za3erYdnK+jR6eLJNbyDeNpGZCPRoCyuxuI3gOyCBFqFj5aoLTGzT+NB2RDja/Jj6UF6 IroQ== X-Received: by 10.112.166.106 with SMTP id zf10mr7363871lbb.36.1437018390362; Wed, 15 Jul 2015 20:46:30 -0700 (PDT) Received: from opensuse.site (ppp91-77-243-215.pppoe.mtu-net.ru. [91.77.243.215]) by smtp.gmail.com with ESMTPSA id z1sm1677675lbj.11.2015.07.15.20.46.29 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 15 Jul 2015 20:46:29 -0700 (PDT) Date: Thu, 16 Jul 2015 06:46:30 +0300 From: Andrei Borzenkov To: Vladimir =?UTF-8?B?J8+GLWNvZGVyL3BoY29kZXIn?= Serbinenko Subject: Re: [PATCH] zfs: fix compilation failure with clang due to alignment Message-ID: <20150716064630.466812fa@opensuse.site> In-Reply-To: <55A6810A.60408@gmail.com> References: <1435950347-20073-1-git-send-email-arvidjaar@gmail.com> <55A6810A.60408@gmail.com> X-Mailer: Claws Mail 3.11.0 (GTK+ 2.24.28; x86_64-suse-linux-gnu) MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; boundary="Sig_/1bxxjGqvkumHXUFIoLcPmQW"; protocol="application/pgp-signature" X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2a00:1450:4010:c03::229 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 03:46:37 -0000 --Sig_/1bxxjGqvkumHXUFIoLcPmQW Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable =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. > >=20 > > fs/xfs.c:452:25: error: cast from 'struct grub_xfs_btree_node *' to > > 'grub_uint64_t *' (aka 'unsigned long long *') increases required > > alignment from 1 to 8 [-Werror,-Wcast-align] > > grub_uint64_t *keys =3D (grub_uint64_t *)(leaf + 1); > > ^~~~~~~~~~~~~~~~~~~~~~~~~~~ > > 1 error generated. > >=20 > > --- > >=20 > > Jan, do you have any idea what's wrong and whether this is proper fix? > > Or should I raise it with clang? > >=20 > > grub-core/fs/xfs.c | 6 +++--- > > 1 file changed, 3 insertions(+), 3 deletions(-) > >=20 > > 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, stru= ct 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 required > but most likely it is. > >=20 >=20 >=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. Jan, do I miss something? --Sig_/1bxxjGqvkumHXUFIoLcPmQW Content-Type: application/pgp-signature Content-Description: OpenPGP digital signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iEYEARECAAYFAlWnKRYACgkQR6LMutpd94yMhgCgzr8qzJ2BgDDqqa0CJRiUFWWI 6gwAniB7TfqF40HPv8J1ft0VS+wJCu5y =WkXL -----END PGP SIGNATURE----- --Sig_/1bxxjGqvkumHXUFIoLcPmQW--