From mint-bounce@lists.fishpool.fi  Tue Jan 22 17:29:10 2008
X-Original-To: fnaumann@mail.boerde.de
Delivered-To: fnaumann@mail.boerde.de
Message-ID: <4749F7DC.6050708@highlandsun.com>
Date: Sun, 25 Nov 2007 14:31:56 -0800
From: Howard Chu <hyc@highlandsun.com>
User-Agent: Mozilla/5.0 (X11; U; Linux i686; rv:1.9b2pre) Gecko/2007111122 SeaMonkey/2.0a1pre
MIME-Version: 1.0
To: Thomas Huth <th.huth@googlemail.com>
Cc: =?UTF-8?B?VmluY2VudCBSaXZpw6hyZQ==?= <vriviere@users.sourceforge.net>,
        emutos-devel@lists.sourceforge.net, mint@fishpool.com
Subject: Re: [MiNT] [Emutos-devel] Emutos and gcc-4.2.2
References: <4745708C.5010104@users.sourceforge.net>	 <20071123005939.11adea43@phineus>	 <47476378.1080906@users.sourceforge.net> <d32dfd680711250417x41b79514oda883acb04b3df23@mail.gmail.com>
In-Reply-To: <d32dfd680711250417x41b79514oda883acb04b3df23@mail.gmail.com>
Content-Type: text/plain; charset=UTF-8; format=flowed
X-MIME-Autoconverted: from 8bit to quoted-printable by highlandsun.propagation.net id lAPMYDum003161
X-ecartis-version: Ecartis v1.0.0
Sender: mint-bounce@lists.fishpool.fi
Errors-To: mint-bounce@lists.fishpool.fi
X-original-sender: hyc@highlandsun.com
Precedence: bulk
List-help: <mailto:ecartis@lists.fishpool.fi?Subject=help>
List-unsubscribe: <mailto:mint-request@lists.fishpool.fi?Subject=unsubscribe>
List-Id: <mint.lists.fishpool.fi>
X-List-ID: <mint.lists.fishpool.fi>
List-subscribe: <mailto:mint-request@lists.fishpool.fi?Subject=subscribe>
List-owner: <mailto:tjhukkan@fishpool.fi>
List-post: <mailto:mint@lists.fishpool.fi>
X-Virus-Scanned: by amavisd-new at relay.boerde.de
X-Spam-Checker-Version: SpamAssassin 2.63 (2004-01-11) on relay.boerde.de
X-Spam-Status: No, hits=-1.0 tagged_above=-50.5 required=7.0 tests=BAYES_00
X-Spam-Level: 
Content-Transfer-Encoding: 8bit
X-MIME-Autoconverted: from quoted-printable to 8bit by freemint id m0MGP1at004618
Status: 
X-Status: 
X-Keywords:                   

Thomas Huth wrote:
>  Hi!
> 
> On Nov 24, 2007 12:34 AM, Vincent Rivière
> <vriviere@users.sourceforge.net> wrote:
>> I would like to speak about another "feature" : alignment.
>>
>> By default, GCC aligns structure members on 4-byte boundaries, producing
>> useless 2-byte holes in a structure where longs and shorts are mixed. I
>> patched it long ago to use a 2-byte default alignment, so no space is
>> wasted. Some people said that the 68020+ CPU have faster memory access
>> to longs aligned on 32-bit boundaries. Is it true on Atari computers ?

Yes, on Atari TT and Falcon030. It's true for any system with 68020+, which 
all have 32 bit data buses.

> I've heard that, too, but I am not an expert here ... that's maybe a
> better question to the MiNT developers since they are more likely
> working on 68030 machines than the folks here on the EmuTOS mailing
> list.

>> I recently discovered another "feature" of GCC. When function arguments
>> are pushed on the stack, they are aligned on an "int" boundary. When
>> compiling with -mshort, there is no additional filler. But when -mshort
>> is not used, pushing a short then a long causes the long to be aligned 2
>> bytes further. A short filler is inserted between the 2 values. Just
>> like structure alignment, it seems to me that such alignment is useless
>> on the Atari platform. I plan to remove this alignment in my next build.

Bad idea.
> 
> Well, I think the default size of items that are pushed on the stack
> should be sizeof(int).
> For example when you have declared following function in one file:
> 
> int myfunc(int a, int b)
> {
>     return a + b;
> }
> 
> And in another file you call myfunc(3, 5), but there is no prototype
> for myfunc before...
> ... this is perfectly valid C (despite it's ugly due to the missing
> prototype), but it will fail as soon as you disable this "filler"
> values on the stack. I think it's better not to disable these
> "fillers".

Right.

-- 
   -- Howard Chu
   Chief Architect, Symas Corp.  http://www.symas.com
   Director, Highland Sun        http://highlandsun.com/hyc/
   Chief Architect, OpenLDAP     http://www.openldap.org/project/


