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++/17499] long long constant broken


------- Additional Comments From pyrodave at msn dot com  2004-09-17 18:09 -------
> gcc-3.3.4 gives the following warning:-
> "integer constant is too large for its type".
> and gives "value is 0" as its output. 
> 
> gcc-3.3.3 gives no such warning and gives :
> " value is 8000000000000" as its answer. 

I just found this bug report while researching a problem I was having.

using gcc-3.2.2 the following code:
#include <stdio.h>
typedef unsigned long long USB64;
unsigned long long zz;
int main()
{
   
  zz = 10293847561029384756; 
  char aa[20];
  sprintf(aa , "%20.20d" , zz);
  printf("%s\n",aa);
}
 generated the warning "Decimal constant is so large it is unsigned" and
compiled, but when ran, the result is 00000000001328380468.

When I changed it to add the ULL at the end of the constant, the warning
disappeared but the result was the same.

I just installed gcc-3.3.4-20040914 and got exactly the same results.

-- 


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


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