Boost logo

Boost Users :

From: Geoff Wedig (gwedig_at_[hidden])
Date: 2007-12-10 18:47:24


Hello,

We are experiencing a problem with boost::random using icc on Windows
under optimization. If we compile with the -O1 option, we get correct
behavior. Compiling with -O2 or no -O option gives us a string of zeros.

We have compiled a small test case which shows this problem:

#include "boost/function.hpp"
#include "boost/random.hpp"

#include <iostream>
#include <iomanip>

using namespace std;

typedef boost::lagged_fibonacci607 RGType;
typedef boost::uniform_smallint<> DistType;
typedef boost::variate_generator<RGType, DistType> GeneratorType;

int main()
{
    DistType mainDist(0,10000);
    RGType mainEng((boost::uint32_t) 12);
   
    GeneratorType mainGen(mainEng, mainDist);
   
    for(size_t i = 0; i != 10; ++i)
        cout << mainGen() << ", ";
   
    cout << endl;
}

To date, I've done a lot of hunting trying different compiler options to
attack this problem. The compiler option which seems to have the most
consistent effect, in that adding it makes the program work, whereas
removing it makes it not is -Qunroll0.

I am guessing something in the optimization is causing the generator not
to initialize properly, but I do not, at present, know how to solve it.

Has anyone else seen this, or have any ideas what might be going wrong?

I appreciate any ideas.

Thanks,

Geoff Wedig
Digital Domain


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net