From owner-freebsd-arm@FreeBSD.ORG Sun Nov 12 14:51:50 2006 Return-Path: X-Original-To: arm@FreeBSD.org Delivered-To: freebsd-arm@FreeBSD.ORG Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 08BC416A415; Sun, 12 Nov 2006 14:51:50 +0000 (UTC) (envelope-from ru@rambler-co.ru) Received: from relay0.rambler.ru (relay0.rambler.ru [81.19.66.187]) by mx1.FreeBSD.org (Postfix) with ESMTP id 7B71443D8F; Sun, 12 Nov 2006 14:51:48 +0000 (GMT) (envelope-from ru@rambler-co.ru) Received: from relay0.rambler.ru (localhost [127.0.0.1]) by relay0.rambler.ru (Postfix) with ESMTP id 99F2C5DAE; Sun, 12 Nov 2006 17:51:47 +0300 (MSK) Received: from edoofus.park.rambler.ru (unknown [81.19.65.108]) by relay0.rambler.ru (Postfix) with ESMTP id 533EA5DAB; Sun, 12 Nov 2006 17:51:47 +0300 (MSK) Received: (from ru@localhost) by edoofus.park.rambler.ru (8.13.8/8.13.8) id kACEppa0050144; Sun, 12 Nov 2006 17:51:51 +0300 (MSK) (envelope-from ru) Date: Sun, 12 Nov 2006 17:51:51 +0300 From: Ruslan Ermilov To: Giorgos Keramidas Message-ID: <20061112145151.GC49703@rambler-co.ru> References: <20061112133929.9194773068@freebsd-current.sentex.ca> <20061112140010.GA47660@rambler-co.ru> <20061112142710.GE91556@wombat.fafoe.narf.at> <20061112133929.9194773068@freebsd-current.sentex.ca> <20061112140010.GA47660@rambler-co.ru> <20061112144230.GC2331@kobe.laptop> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="ABTtc+pdwF7KHXCz" Content-Disposition: inline In-Reply-To: <20061112144230.GC2331@kobe.laptop> User-Agent: Mutt/1.5.13 (2006-08-11) X-Virus-Scanned: No virus found Cc: arm@FreeBSD.org, current@FreeBSD.org Subject: Re: [head tinderbox] failure on arm/arm X-BeenThere: freebsd-arm@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Porting FreeBSD to the StrongARM Processor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 12 Nov 2006 14:51:50 -0000 --ABTtc+pdwF7KHXCz Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Sun, Nov 12, 2006 at 03:42:30PM +0100, Giorgos Keramidas wrote: > On 2006-11-12 17:00, Ruslan Ermilov wrote: > > > /src/lib/libelf/elf_rand.c: In function `elf_rand': > > > /src/lib/libelf/elf_rand.c:47: warning: cast increases required align= ment of target type > > > *** Error code 1 > > > > > > Stop in /src/lib/libelf. > > > *** Error code 1 > > > > This looks like a GCC bug to me. The following code snippet, > > when compiled on FreeBSD/arm, causes a -Wcast-align warning > > which doesn't look right: > > > > %%% > > $ cat a.c > > struct foo { > > char x; > > }; > > > > struct foo * > > bubu(char *s) > > { > > > > return (struct foo *)s; > > } > > $ cc -c -Wcast-align a.c > > a.c: In function `bubu': > > a.c:9: warning: cast increases required alignment of target type > > %%% > > > > (None of other supported architecutes see the issue here.) >=20 > You can't cast any random (char *) pointer to a pointer of a type which > is (potentially) larger than 1 byte. It's the same sort of warning you > will get if you try to: >=20 > char ch[] =3D "\x00\x00\x00\x00"; > char *p =3D &(ch[0]); > unsigned long *lptr =3D (unsigned long *)p; >=20 > You cannot guarantee that `ch' is stored in an address that is properly > aligned for (unsigned long), and this is what GCC warns about here. >=20 No, your example I perfectly understand but it is completely different. Note that the first (and only) member in my structure is "char", so it doesn't need to be more than sizeof(char) aligned. > On 2006-11-12 15:27, Stefan Farfeleder wrote: > > What is sizeof(struct foo)? If it's > 1 it makes sense. >=20 > Exactly :) >=20 Still doesn't make much sense to me. If all structure members are chars (like is the case with "struct ar_hdr" from which GCC complains about, and in my example, the required alignment shouldn't be more than sizeof(char). What am I missing? Cheers, --=20 Ruslan Ermilov ru@FreeBSD.org FreeBSD committer --ABTtc+pdwF7KHXCz Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.5 (FreeBSD) iD8DBQFFVzUHqRfpzJluFF4RAk/2AJ4/N4i6u2+Zz/RRzNDStRX76CV2fgCfXLiX RuNsL3WxU6JxtoI7ZX+Oi34= =Ibh/ -----END PGP SIGNATURE----- --ABTtc+pdwF7KHXCz--