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

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.;
Standard_Real ang;

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.;
Standard_Real ang;

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?

Denis Barbier 2012/08/07 00:07

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 CAD Assistant for iOS platform is available!
  • Open CASCADE Technology 6.9.0 is available for download!
  • JT Assistant for Android

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