Path: chuka.playstation.co.uk!news From: "pal" Newsgroups: scee.yaroze.freetalk.english Subject: Re: Ten bytes bug in gcc? Date: 15 Aug 2001 09:56:14 GMT Organization: PlayStation Net Yaroze (SCEE) Lines: 31 Message-ID: <01c12570$15068c00$a708e4d5@pal-s-omnibook> 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> NNTP-Posting-Host: nas-cbv-6-8-167.dial.proxad.net X-Newsreader: Microsoft Internet News 4.70.1155 Majik wrote in article <3B7A41C2.B4C5098E@127.0.0.1>... > mybuffer: [reserve 4 bytes] > [reserve 4 bytes] > [reserve 2 bytes] > dummy: [reserve 2 bytes] > main: [some code] > > the problem is, as far as I remember, is that neither of the labels > dummy: or main: occur on a 4 byte > boundary 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. If main is not 4-byte aligned, then there have to be some filling bytes between mybuffer and dummy (or dummy and main), but then these bytes cannot have been reserved other than for alignment, can they? Then dummy would have undergone alignment, but main would not, which is rather unfair behaviour (esp. considering that code is usually more sensitive to alignment). 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)? pal