Path: chuka.playstation.co.uk!news From: Majik Newsgroups: scee.yaroze.freetalk.english Subject: Re: Ten bytes bug in gcc? Date: Wed, 15 Aug 2001 11:12:50 +0100 Organization: PlayStation Net Yaroze (SCEE) Lines: 24 Message-ID: <3B7A4B22.F0AB3595@127.0.0.1> References: <01c124b1$16cc8cc0$LocalHost@pal-s-omnibook> <9lbdjv$ds71@www.netyaroze-europe.com> <01c1250d$76401bc0$501ce4d5@pal-s-omnibook> <3B7A41C2.B4C5098E@127.0.0.1> <01c12570$15068c00$a708e4d5@pal-s-omnibook> NNTP-Posting-Host: tide136.microsoft.com Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Mailer: Mozilla 4.72 [en] (Windows NT 5.0; I) X-Accept-Language: en pal wrote: > Ok so I agree that the problem must be caused by bad alignment of main. > However, in your example, doesn't main == mybuffer + 12bytes? Then main is > 4byte-aligned. dummy is not, but as it's not used, it's okay. it's not so much as being used or not, its more the fact that it exists that causes a bug in the compilation. It was a fair number of years ago that I sat and stared at some code that crashed the PSX but looked ok, before I 'discovered' that making things 4byte aligned sorted it all out, I'll do another analysis of the problem tonight and post my results then, for those that are interested. > Anyway, I can't understand how such a bug would not cause much more > havoc... any data not properly sized should cause the following functions > to crash, shouldn't it (as I said, it occurred to me with a struct, and I > guess there are a lot of structs out there that are not 4byte multiples)? well, I automatically code to 4 byte boundaries now, because I have seen too many compilers that can't cope with this sort of thing. I guess everyone else does too, though interestingly enough this isn't a problem for x86 machines... they're still intrinsically 8bit CPUs! M.