Date: Tue, 17 Nov 1998 15:56:38 +0200 (IST) From: Eli Zaretskii X-Sender: eliz AT is To: Laszlo Molnar cc: DJGPP Workers List Subject: Re: gcc: feature or bug? In-Reply-To: <19981117131553.B17146@duna58> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Reply-To: djgpp-workers AT delorie DOT com On Tue, 17 Nov 1998, Laszlo Molnar wrote: > Let's say I have a 32-bit unsigned integer, and I want to clear it's > most significant bit. I wrote this code: > > (x*2)/2 > > And of course(?) it doesn't work. Is it a bug in gcc or a bug in me? Did you compile with -O? Did you look at the assembly produced by GCC? It is quite possible that the optimizer optimized this into oblivion. Try this: volatile int x; x *= 2; x /= 2; Does this help?