From mboxrd@z Thu Jan 1 00:00:00 1970 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 111c93,100c510dac09e617 X-Google-Attributes: gid111c93,public From: Volker Barthelmann Subject: Re: MFlops Comparison using g77 (bad news) - bench.tgz (0/1) Date: 1997/09/23 Message-ID: <6085fm$3ea@vb.franken.de>#1/1 X-Deja-AN: 274950250 References: <6060pv$kn6@news.cis.okstate.edu> <6078ji$5j0@news2.zippo.com> Organization: home Newsgroups: comp.os.linux.alpha Greg Lindahl wrote: : jwest@jwest.ecen.okstate.edu (Jim West) writes: : > I'm wondering if an optimizing compiler sould pick this up even without the : > explicit definition of nx_r. Can anyone explain why it wouldn't? : aliasing? : -- g : (no, I didn't look closely, but such a small kernel routine : in C is always at risk for aliasing problems...) Yes, a C compiler may not cache the values, because in for (i=1;i<*nx-1;i++) { indx = i+indj; psi_new[indx] = (*a1)*psi[indx+1]+(*a2)*psi[indx-1]+ (*a3)*psi[i+indjp1]+(*a4)*psi[i+indjm1]- (*a5)*f[indx]; } the write to psi_new[indx] could modify all the other values. When the restrict keyword will be supported in a future C standard this could be avoided. Volker