FW: [ODE] Bug reporting

Michal Bacik michal at lonelycatgames.com
Thu Feb 13 07:22:02 2003


> > If reading uninitialized variable is a bug, then here it is:
> >
> > file ode/src/mass.cpp, function checkMass - *** use of uninitialized
> > variable 'dMatrix3 I2' ***
> > func performs dMULTIPLY0_333(I2,chat,chat); which writes first
> 3 members of
> > each row, leaving mess in fourth. One line below: for (int i=0;
> i<12; i++)
> > I2[i] = m->I[i] + m->mass*I2[i]; all 12 members of I2 are read,
> including
> > uninitialized ones. FPU won't be happy...
>
> This isn't really a bug, it's an inefficiency.  Because those 4th values
> don't affect the simulation, it doesn't matter that we're filling them
> with the product of the mass and an uninitialized value.  It's extra work
> to multiply the two of them because we don't need the result, but not
> really an error.  Unless you have signaling NaNs or overflows I suppose...

This seems to be a matter of taste... You're right, I've FPU exceptions on
and my build config fills all uninitialized variables by mess (mess which is
a signaled NaN if used by FPU).

I prefer knowing when I use uninitialized variable. So I treat this to be a
bug (as it produces crash).
Here's possible work-around:

  dMULTIPLY0_333 (I2,chat,chat);
  I2[3] = 0.0f;
  I2[7] = 0.0f;
  I2[11] = 0.0f;

- michal