| www.delorie.com/archives/browse.cgi | search |
| Date: | Tue, 17 Nov 1998 15:56:38 +0200 (IST) |
| From: | Eli Zaretskii <eliz AT is DOT elta DOT co DOT il> |
| X-Sender: | eliz AT is |
| To: | Laszlo Molnar <laszlo DOT molnar AT eth DOT ericsson DOT se> |
| cc: | DJGPP Workers List <djgpp-workers AT delorie DOT com> |
| Subject: | Re: gcc: feature or bug? |
| In-Reply-To: | <19981117131553.B17146@duna58> |
| Message-ID: | <Pine.SUN.3.91.981117155446.15372C-100000@is> |
| MIME-Version: | 1.0 |
| 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?
| webmaster | delorie software privacy |
| Copyright © 2019 by DJ Delorie | Updated Jul 2019 |