This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
c++/6774: printf("%lld") prints bad values
- From: brian at talusmusic dot com
- To: gcc-gnats at gcc dot gnu dot org
- Date: 23 May 2002 00:41:13 -0000
- Subject: c++/6774: printf("%lld") prints bad values
- Reply-to: brian at talusmusic dot com
>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: