Open CASCADE, the 3D modelling kernel
3D modeling & numerical simulation

Search the Forums
See All Topics
 

random conditional jump in BRepLib.cxx tgtfaces()

random conditional jump in BRepLib.cxx tgtfaces()
Martin Siggel 2012/08/03 16:49
Hello,

I think I found a bug in BRepLib.cxx in line 1587 (OCCT release 6.5.3):

the code line is the following:
if(ang >= angmax) angmax = ang;

In some circumstances ang is not initialized at this line because it will only be calculated if the variable Nok is true. I would suggest to change the code to
if(Nok && (ang >= angmax)) angmax = ang;

The bug affects the return value of the function and has probably a great impact. I am new to OCCT, so I don't know the internals very well. So maybe I am also wrong here.

Best regards, Martin
Pawel 2012/08/06 17:31
Hello Martin,

the variable 'ang' is declared as follows:

#ifndef DEB
Standard_Real ang =0.;
#else
Standard_Real ang;
#endif

which means it will be initialized to '0' only in Release mode. I think the initialization should rather look like this:

#ifdef DEB
Standard_Real ang =0.;
#else
Standard_Real ang;
#endif

because in the Release mode the compiler makes sure the variable is '0' any way (at least Visual Studio).

But in your case the Release version of OCCT should work OK.

Do you have a specific test case?

Pawel
Denis Barbier 2012/08/07 00:07
Hello,

There is some inconsistency between initializations of ang and angmax, IMHO ang should be initialized to -M_PI too.

By the way it would be much more simple to not use this DEB macro at all, it is almost useless in the whole OCCT source code.
 
 
Latest news
  • Open CASCADE Technology 6.8.0 is available for download!
  • New features to enhance the development process
  • Open CASCADE Technology 6.7.1 is available for download!

  • © OPEN CASCADE 2000 - 2014  |  Search  |  Contacts   |  Site map