Path: chuka.playstation.co.uk!news From: "Martin Day" Newsgroups: scee.yaroze.programming.gnu_compiler Subject: Re: Optimise Problem - trunced data Date: 4 Aug 1997 13:35:33 GMT Organization: SN Systems Ltd Lines: 47 Message-ID: <01bca0db$fb8dfdc0$ca2c9ac2@martin.snsys.com> References: <333d7fd9.23907964@news.playstation.co.uk> <33424023.72C4@interactive.sony.com> <33D5B732.3AC9@dial.pipex.com> <01bc9c44$3fe961e0$ca2c9ac2@martin.snsys.com> <33E39782.6C3F@dial.pipex.com> Reply-To: "Martin Day" NNTP-Posting-Host: martin.snsys.com X-Newsreader: Microsoft Internet News 4.70.1162 Chris Chadwick wrote in article <33E39782.6C3F@dial.pipex.com>... > ... > > Hmmmm! Neat solution, Martin ;) > > Of course we still couldnt optimize the code module that actually > assigns the address of PSDCNT etc. to the pointers as the mere > mention of these variables, using optimization, turns the compiler > egg-shaped. If you simply initialise global variables with the address as in my example : int *pmath_errno = &math_errno; then it should work fine. Doesn't this work for you? Here's another alternative that I think should work though I've not been able to try it properly. Modify the declarations in libps.h to change extern u_long PSDCNT; to extern u_long PSDCNT[]; and now use *PSDCNT to access this variable (or PSDCNT[0] if you prefer). Since you don't tell the compiler the dimension of the 'array' PSDCNT it decides it must be in the .data section rather than .sdata and so won't optimise the accesses to it. Change the variables that are arrays, e.g. extern short PSDOFSX[2], PSDOFSY[2]; to unspecified dimension too, i.e. extern short PSDOFSX[], PSDOFSY[]; in this example. -- Martin martin@snsys.com +44 117 929 9733