public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/14449] New: long long & unsigned calculation gives wrong result
@ 2004-03-05 16:14 joerg dot richter at pdv-fs dot de
  2004-03-05 16:44 ` [Bug target/14449] " pinskia at gcc dot gnu dot org
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: joerg dot richter at pdv-fs dot de @ 2004-03-05 16:14 UTC (permalink / raw)
  To: gcc-bugs

This program:

-----8<--------------
#include <stdio.h>

int main()
{
  unsigned int i = 2147483648u;
  long long k = ((long long)i) * 10;
  printf( "%lld\n", k );
  long long m = i;
  m = m * 10;
  printf( "%lld\n", m );
}

-----8<--------------

gives following output
-64424509440
21474836480

But I would expect (like on i686-pc-linux-gnu)
21474836480
21474836480

Confirmed with 
GCC 3.3.3
GCC 3.2.1
GCC 2.9-aix51-020209

g++ -v prints
Reading specs from /pdv/.tools/pkg/gcc/3.3.3/bin/../lib/gcc-lib/powerpc-ibm-
aix5.1.0.0/3.3.3/specs
Configured with: ../gcc-3.3.3/configure --prefix=/tools/pkg/gcc/3.3.3 --with-
ld=/bin/ld --with-as=/bin/as --enable-languages=c,c++
Thread model: aix
gcc version 3.3.3

-- 
           Summary: long long & unsigned calculation gives wrong result
           Product: gcc
           Version: 3.3.3
            Status: UNCONFIRMED
          Severity: critical
          Priority: P2
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: joerg dot richter at pdv-fs dot de
                CC: gcc-bugs at gcc dot gnu dot org
 GCC build triplet: powerpc-ibm-aix5.1.0.0
  GCC host triplet: powerpc-ibm-aix5.1.0.0
GCC target triplet: powerpc-ibm-aix5.1.0.0


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


^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2004-11-28 21:07 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-03-05 16:14 [Bug c++/14449] New: long long & unsigned calculation gives wrong result joerg dot richter at pdv-fs dot de
2004-03-05 16:44 ` [Bug target/14449] " pinskia at gcc dot gnu dot org
2004-03-05 23:08 ` dje at gcc dot gnu dot org
2004-03-06  0:59 ` pinskia at gcc dot gnu dot org
2004-03-06  1:18 ` schwab at suse dot de
2004-03-07  3:17 ` [Bug middle-end/14449] " dje at gcc dot gnu dot org
2004-04-07  2:48 ` pinskia at gcc dot gnu dot org
2004-11-28 21:07 ` roger at eyesopen dot com

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).