This is the mail archive of the gcc-bugs@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]

[Bug c/32324] unsigned long long operator << and integer literals



------- Comment #2 from andrew dot stubbs at st dot com  2007-06-13 18:00 -------
As it happens, I encountered your real problem quite recently. :)

"(int)(1<<31)" is undefined (C99 standard 6.5.7/4).

This modified version gives the same result both ways:

int main (){
   unsigned long long a = 18446744065119617024llu;
   /* results expected to be identical */
#ifdef EXPECTED
   unsigned int b = ((unsigned int)(1<<31));
   a = a / b;
#else
   a = a / ((unsigned int)(1<<31));
#endif

   return a;
}


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=32324


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