For all issues regarding the Forums use, please, refer to the Forum Rules.

Our Solutions

Need professional assistance?
Consider our:

Support Offerings


Need to speed up your development?
Have a look at our:

Samples & Tools


Need some functionality extending standard OCCT capabilities?
Check out our:

Adv. Components

random conditional jump in BRepLib.cxx tgtfaces()

Martin Siggel's picture


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's picture

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's picture


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.