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]

Re: a.out gives different results when compiled by g++ 3.1 and g++ 3.1 -O


Falk Hueffner wrote:

enum {N = 624,              // length of state vector
      M = 397,              // period parameter
      MAGIC = 0x9908B0DFU}; // magic constant

ui32 state[N];              // internal state
[...]
*p++ = twist( p[M-N], p[0], p[1] );

You're accessing out of the array bounds here, so anything might
happen.

Thanks a lot for your prompt answer!

I can't see the problem, the for-loop is entered N-1 times. Valgrind reported nothing wrong.

I don't understand, may you explain further?

Thanks for your help and time,
Regards,
Erick.






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