bug-gplusplus
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Data corruption with g++


From: Jean-Sylvain Sormany
Subject: Data corruption with g++
Date: 1 Aug 2002 07:45:37 -0700

Hi,

While testing an application this week, I found a bug that I can't
explain. It's seem's that, when my source code is optimized with
option -O2 or -03, the results that my application produce are wrong.

I have also discover that, if a add a "cerr" at  a particular place of
my code (even if I protect this cerr with a test that will always be
false) the error cannot be reproduce :

              dMoveCost = dRemoveCost + dAddCost;
                          
              // No location have ID -1
              if (pCurrentLocation->getLocationID() == -1){
                cerr << " Cost : " << dMoveCost << endl;
              }

A know that my application produce, at a certain time a bad value on
dMoveCost. If I add this false test, all seem to works fine...

I passed my code throw Rational Purify to be sure that no memory leak
was the source of this problem.

I also tried to compile it with g++ 2.95, g++ 3.1 and g++ 3.1.1 and
the error is still there with each compilers.

My application is NOT multi-thread and the only particular library
that is used is STL (for list).

Did somebody have an idea of what could produce this kind of trouble? 

Jean-Sylvain



reply via email to

[Prev in Thread] Current Thread [Next in Thread]