This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: GCC optimizes integer overflow: bug or feature?


Denis Vlasenko writes:
 > 
 > I wrote this just a few days ago:
 > 
 >         do {
 >                 int32_t v1 = v << 1;
 >                 if (v < 0) v1 ^= mask;
 >                 v = v1;
 >                 printf("%10u: %08x\n", c++, v);
 >         } while (v != 1);
 > 
 > I would become rather sad if this will stop compiling correctly.

I can understand the objections to do with "dusty deck" code that
hasn't been looked at for aeons, but in the case of code that you
wrote so recently, given that you understand the issue, why not simply
use the standard idiom?

Andrew.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]