Date: Fri, 28 Jan 2005 10:54:24 +0100 From: des@des.no (=?iso-8859-1?q?Dag-Erling_Sm=F8rgrav?=) To: Jacques Fourie <jf@trispen.com> Cc: freebsd-hackers@FreeBSD.ORG Subject: Re: kernel vm question Message-ID: <xzpsm4l281b.fsf@dwp.des.no> In-Reply-To: <20050127160914.GA72454@VARK.MIT.EDU> (David Schultz's message of "Thu, 27 Jan 2005 11:09:14 -0500") References: <41F90140.3020705@trispen.com> <20050127160914.GA72454@VARK.MIT.EDU>
next in thread | previous in thread | raw e-mail | index | archive | help
David Schultz <das@FreeBSD.ORG> writes: > On Thu, Jan 27, 2005, Jacques Fourie wrote: > > unsigned char *p =3D NULL; > > unsigned char v =3D 0x55; > > /* ... */ > > p =3D (unsigned char *)ip_output; > > /* ... */ > > v =3D p[0]; > > p[0] =3D v; > > /* ... */ > When the line is there, the compiler is probably smart enough to > realize that 'x=3Dy; y=3Dx' is (usually) a no-op, so it optimizes away > both statements. Wrong. The compiler is free to optimize away the second statement provided that neither x nor y is declared volatile, but it cannot optimize away the first statement. DES --=20 Dag-Erling Sm=F8rgrav - des@des.no
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?xzpsm4l281b.fsf>