Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 12 Nov 2006 15:52:24 +0100
From:      Giorgos Keramidas <keramida@FreeBSD.org>
To:        Ruslan Ermilov <ru@FreeBSD.org>
Cc:        current@FreeBSD.org
Subject:   Re: [head tinderbox] failure on arm/arm
Message-ID:  <20061112145223.GE2331@kobe.laptop>
In-Reply-To: <20061112144618.GB49703@rambler-co.ru>
References:  <20061112133929.9194773068@freebsd-current.sentex.ca> <20061112140010.GA47660@rambler-co.ru> <20061112142710.GE91556@wombat.fafoe.narf.at> <20061112144618.GB49703@rambler-co.ru>

next in thread | previous in thread | raw e-mail | index | archive | help
On 2006-11-12 17:46, Ruslan Ermilov <ru@freebsd.org> wrote:
>On Sun, Nov 12, 2006 at 03:27:10PM +0100, Stefan Farfeleder wrote:
>>> 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.)
>>
>> What is sizeof(struct foo)?  If it's > 1 it makes sense.
>
> Yes, it's four bytes on ARM.  But why?

Probably because GCC thinks accessing 4-byte quantities is much much
cheaper than 1-byte accesses on this ARM board.  I'm not sure why GCC
thinks so, though.




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20061112145223.GE2331>