Path: chuka.playstation.co.uk!news From: alex@teeth.demon.co.uk (Alex Amsel) Newsgroups: scee.yaroze.programming.3d_graphics,scee.yaroze.programming.gnu_compiler,scee.yaroze.programming.codewarrior Subject: Re: Best Compiler bug ever (almost) Date: Thu, 10 Apr 1997 12:04:16 GMT Organization: Into Beyond Lines: 57 Message-ID: <334ed0d3.1764129@news.playstation.co.uk> References: <334c572f.9721328@news.playstation.co.uk> <334CB737.3E25@interactive.sony.com> Reply-To: alex@teeth.demon.co.uk NNTP-Posting-Host: teeth.demon.co.uk Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Newsreader: Forte Agent .99g/32.335 Xref: chuka.playstation.co.uk scee.yaroze.programming.3d_graphics:72 scee.yaroze.programming.gnu_compiler:17 scee.yaroze.programming.codewarrior:32 On Thu, 10 Apr 1997 10:47:35 +0100, sceetech did quoth at me: >Secondly: trying your code fragment here, we notice that the >length of the name of the array makes NO difference at all, I would expect the same, but last night it was very fussy about the name. I had been up a few hours too long so I'll check today and get back to you. >the fragment always crashes the Yaroze. We suspect >that it is simply the declaration of an array with an odd >number of elements, together with element size being small, >hence there is no aligning on 32bit boundary; the machine is >purely 32bit, and manuals specifically say that non-32bit access >will cause errors. That is what I thought. We created a mapfile but having never used a mapfile before didn't make much sense of much of it. It looked as if half the variables overwrite each other - I think I need to get the gnu docs this weekend! >The REMEDY for this problem is not hard to find: always declare >arrays (and structures, etc, see libps.h) so that they >always align on 4-byte boundaries. I usually do for speed reasons (on other machines anyway). >never padding structures to 4 bytes etc, and have NEVER had >this problem. I must ask exactly what kind of activity led >you to discover this 'problem'; were you testing the >reliability of the compiler / Yaroze? Not at all. We were just comparing my bg routine with the Sony ones as we were just chucking across a pacman level. We were just declaring a few map layers, one was for player stuff. The size was 23*19 u_shorts. There were 3 array declarations in a row, the first two being 1 letter shorter than Playerwhateveritwas. The first two were done fine, but the final one caused the crash no matter what others had been declared. All were tested individually and all was fine except the final one again. We added just a single letter to the variable name (in various places) and it worked fine. So yes, the variable name DEFINATELY did have an effect. Even tried declaring a few variables in between the arrays etc incase they realigned the compiler since that almost certainly was the problem. Don't you just love weird errors. Anyway, for those who haven't tried it, the Yaroze will lock immediately you run the program - no calls ever start from the looks of it. * Alex Amsel * Into Beyond Web Design & JAVA Programming * * http://www.intobeyond.com * WWFC Play off ****ers'97 * MM: "Hand the opposition the lead, the supporters love it"