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]

c++/6774: printf("%lld") prints bad values



>Number:         6774
>Category:       c++
>Synopsis:       printf("%lld") prints bad values
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Wed May 22 17:46:00 PDT 2002
>Closed-Date:
>Last-Modified:
>Originator:     Brian Ceccarelli
>Release:        g++ or g++3
>Organization:
>Environment:
Red Hat Linux on Intel
Mandrake Linux on Intel
>Description:
# include <stdio.h>

int main(int c, char *argv[])
{
   long long   i;
   long long   n;

   for (i=0LL; i<63LL; i++)
      {
      n = 1LL << i;
      printf("1 << %d = %lld\n", i, n);
      }

   return 0;

}


%lld is giving 64 bit results for i < 32 and 0 for i >= 32.
>How-To-Repeat:
Execute above program.
>Fix:
None that I can see.   Is 64-bit integer formatting supported by g++ compilers?  Doesn't seem so.
>Release-Note:
>Audit-Trail:
>Unformatted:


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