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/15437] New: int vs const int computation: different answers


#include <iostream.h>

int main(){
  int x = 1000;
  const int y = 1000;

  cerr << "f(x) = " << (int)(x*0.3) << endl;
  cerr << "f(y) = " << (int)(y*0.3) << endl;
}

/*
Produces Output:

f(x) = 299
f(y) = 300

??????????????????????
*/

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

- System type: Redhat Linux on Intel machine
- No special compile options (eg g++ main.cpp)

-- 
           Summary: int vs const int computation: different answers
           Product: gcc
           Version: 3.2
            Status: UNCONFIRMED
          Severity: critical
          Priority: P2
         Component: c
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: lani at oas dot ca
                CC: gcc-bugs at gcc dot gnu dot org


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


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