[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [MiNT] How serious is GCC "cast increases requiered alignment of target type" warning?
- To: mint@lists.fishpool.fi
- Subject: Re: [MiNT] How serious is GCC "cast increases requiered alignment of target type" warning?
- From: Vincent Rivière <vincent.riviere@freesbee.fr>
- Date: Wed, 26 May 2010 14:45:21 +0200
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:sender:message-id:date:from :user-agent:mime-version:to:subject:references:in-reply-to :content-type:content-transfer-encoding; bh=RHgcqA16lUFIeyQj32PaeOSPs7FTQLaam1VVRX3QRIk=; b=XdCWgNiofNy5gc8sbif0qPUxgE+zMJ1Hhu7x0GCQH/iTuRAtIMX+G/PLAdq+zjES/G Yh+FapvWZPbPVd4/rFQLro12kOB/AgxPV60EeIjZLRAV7fghZgsqDLOkB6KEhcQjKdIk ExHUGBSQ/e3Q9rRpX5ivxOdv2v8FUd/lNN918=
- Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=sender:message-id:date:from:user-agent:mime-version:to:subject :references:in-reply-to:content-type:content-transfer-encoding; b=Rxzzw3NcHFrytUEdiVzeg2NiMOeLbst9JJ3a1gTLa49LLg8Hiv3R1A7QRR5c4UUE7b cRnLDFK7H/xTGXoUpHCApgykpRCP60Yh/LUm1zjPpRCSSK8Qyrt9IfvkakcVZ/NEVozT LAlMVGZLX/lHXPqJhgexPhAlAKMk8uMO3/Xa8=
- In-reply-to: <dc0a93e47d194b4a6182594a2ea9c740-EhVcX1lFRQVaRwYcDTpQCEFddQZLVF5dQUBFBDBTXF5bVkYOWUF3CVI6XF1YRU0FWV1aRA==-webmailer2@server07.webmailer.hosteurope.de>
- List-help: <mailto:ecartis@lists.fishpool.fi?Subject=help>
- List-id: <mint.lists.fishpool.fi>
- List-owner: <mailto:tjhukkan@fishpool.fi>
- List-post: <mailto:mint@lists.fishpool.fi>
- List-subscribe: <mailto:mint-request@lists.fishpool.fi?Subject=subscribe>
- List-unsubscribe: <mailto:mint-request@lists.fishpool.fi?Subject=unsubscribe>
- References: <4BFCEFF8.7030106@freesbee.fr> <0003d272.019a6e9ea6a8@smtp.freeola.net> <3979b328d2ec700d36fa822a1a925845-EhVcX1lFRQVaRwYcDTpQCEFddQZLVF5dQUBFBDBTXF5bVkYOWUF3CVI6XF1YRU0FW1xdQw==-webmailer2@server07.webmailer.hosteurope.de> <4BFD0C64.30207@freesbee.fr> <dc0a93e47d194b4a6182594a2ea9c740-EhVcX1lFRQVaRwYcDTpQCEFddQZLVF5dQUBFBDBTXF5bVkYOWUF3CVI6XF1YRU0FWV1aRA==-webmailer2@server07.webmailer.hosteurope.de>
- Sender: mint-bounce@lists.fishpool.fi
- User-agent: Thunderbird 2.0.0.24 (Windows/20100228)
m0n0 wrote:
m68k-atari-mint-gcc -c testm.c -Wall -Wcast-align
You didn't mention that -Wcast-align option !
This is why I never saw your warning, because it is disabled by default.
return (uint32_t *)(nsfb->ptr + (y * nsfb->linelen) + (x << 2));
I can't compile right now, but now I understand.
If nsfb->ptr is aligned on 4 and nsfb->linelen is a multiple of 4, the
result will always be aligned, since (x << 2) is always a multiple of 4.
However, the compiler can't be sure about that so it generates a warning.
So in this case, if the requirements are met, the returned pointer will
always be valid, and the warning can safely be ignored.
--
Vincent Rivière