View Issue Details

IDProjectCategoryView StatusLast Update
0023132CommunityOCCT:Foundation Classespublic2013-04-29 15:21
ReporterQbProg Assigned Toomy 
PrioritynormalSeveritytweak 
Status closedResolutionfixed 
PlatformWindowsOSVC++ 2010 
Product Version6.5.3 
Target Version6.6.0Fixed in Version6.6.0 
Summary0023132: Suspicious code snippets
DescriptionI'm sending you a bunch of suspicios lines found some time ago while removing warnings. I didn't know the 100% proper fix, maybe you could take a look. Probably the "dead code" ones are intended, and the code was left there unused.
---
src\Aspect\Aspect.cxx , line 116
"cast truncates constant value" warning.
Changing to 0xFEE0u is warning-clean, but I don't know if it works.
--
if you search all around the code RWStepBasic for the string
 ent->Init(hasAprefix,aPrefix,aName);
you will see that in all these functions, in case of error, the failure message is added, but the values are used anyway.
In case of error the used variables have an undefined value.
--
TopOpeBRepTool\TopOpeBRepTool_mkTondgE.cxx , line 367

the return statement makes the remaining code in the scope never executed. Is this intended?
---
GeomFill\GeomFill_LocationGuide.cxx, line 745
the return statement makes the whole scope dead code. Is this intended?
----
src\IntTools\IntTools_EdgeFace.cxx

Line 901 : you see there's a return 0 in a scope, that makes the remaining of the function dead code. Is it intended?
---------
src\BRepFill\BRepFill_OffsetWire.cxx , line 622

  if (CT2d->BasisCurve()->IsKind(STANDARD_TYPE(Geom2d_Circle)) &&
      ( Abs(f-l) >= M_PI) ) {
    return 0; //

the return makes the remaining scope dead code. Is it intended?
--------
src\TopOpeBRep\TopOpeBRep_ShapeIntersector2d.cxx , line 281
the NextFFCouple() line is never executed
---
src\V2d\V2d_RectangularGraphicGrid.cxx , line 71
 alpha = Standard_ShortReal ( alpha - 1.57/2.0 );
that is probably PI / 4
and in the line above the two 1.57 are just PI / 2
maybe the 1.41 is sqrt(2) ?
---
src\IFSelect\IFSelect_WorkSession.cxx , line 2825

  thecheckana = TCollection_AsciiString (' ',nb+1);
probably the constructor parameters are reversed, should be nb+1,' '
---
TagsNo tags attached.
Test case numberNot needed

Relationships

parent of 0023140 closedaba Suspicious if 
parent of 0023141 closedaba Suspicious if (2) 
parent of 0023142 closedika GccAna : suspicious else 
parent of 0023143 closedomy Suspicious else 
parent of 0023144 closedomy Suspicious if (3) 
parent of 0023145 closedika Suspicious else (2) 
parent of 0023146 closedbugmaster Suspicious if (4) 
parent of 0023147 closedomy Suspicious if (5) 
parent of 0023288 closedaba IntCurve_IntConicConic_1.cxx: if(A) {...} else if (A){...} pattern detected 
parent of 0023289 closedaba IntCurve_IntPolyPolyGen.gxx, suspicious else 
parent of 0023290 closedika IntCurve_IntPolyPolyGen.gxx, suspicious if/for 
parent of 0023291 closedika GccAna_Circ2d3Tan_8.cxx, suspicious if 
parent of 0023293 closedemv boptools_tools2d.cxx 333 suspicious if/else 
parent of 0023309 closedemv The 'then' statement is equivalent to the 'else' statement in TopOpeBRep_EdgesFiller.cxx 
parent of 0023312 closedaba Suspicious for loop in BiTgte_Blend.cxx 

Activities

abv

2012-05-04 12:53

manager   ~0020473

I suggest we create separate issues (children of this one) per problem type / OCCT module, to simplify code review.

QbProg

2012-05-04 15:57

reporter   ~0020478

should I do that?
how can I create a "child" issue? or the relationship is assigned after the creation?

abv

2012-05-04 16:02

manager   ~0020480

QbProg: I hope Dmitry will create child issues, though if you wish you can do this as well. The relationships between issues are set after the issues are created (see block 'Relationships').

QbProg

2012-05-06 19:59

reporter   ~0020489

I cannot set the relashionships, probably I don't have the rights.
I have added other issues related to this one, you may want to set these related to this one too.

omy

2012-10-19 15:17

developer   ~0021853

Dear OAN,
Fix is is integrated into branch CR23132.
Please, review.

oan

2012-10-22 11:09

developer   ~0021873

Dear JGV,
please review the changes.

jgv

2012-10-23 16:39

developer   ~0021908

No remarks

apn

2012-10-31 18:56

administrator   ~0022039

Dear BugMaster,
Branch CR23132(and products from GIT master) was compiled on Linux and Windows platforms and tested.

Regression:
boolean bfuse_complex Q8 Q9
caf named_shape E8
caf driver A8

Improvements:
Not detected

Testing case:
Not needed

omy

2012-11-08 13:18

developer   ~0022145

Dear apn,
I've fixed the mistake that led to fails in test cases, that you mentioned.
Please, test.

mkv

2012-11-09 14:37

tester   ~0022179

Last edited: 2012-11-21 14:39

Dear BugMaster,
Branch CR23132 (and products from occt GIT master) was compiled on Linux and Windows platforms and tested.

Regressions:
Not detected

Improvements:
Not detected

Testing cases:
Not needed

mkv

2012-11-22 11:51

tester   ~0022350

Dear BugMaster,
Branch CR23132 (and products from occt GIT master) was compiled on Linux and Windows platforms and retested.

Regressions:
Not detected

Improvements:
Not detected

Testing cases:
Not needed

Related Changesets

occt: master 4e76d93b

2012-11-16 09:30:31

omy

Details Diff
0023132: Suspicious code snippets

1) Warning in Aspect.cxx couldn't be reproduced
2) Description of changes: added 'return' statements into ReadStep(...) functions of RWStepBasic_* classes.
3) BRepFill_OffsetWire.cxx - removed dead code;
4) IFSelect_WorkSession.cxx - swapped arguments;
5) TopOpeBRep_ShapeIntersector2d.cxx - removed 'brake' statement and changed loop to if-statement because of
void TopOpeBRep_ShapeIntersector2d::FindFFIntersection() function's call features.
6) V2d_RectangularGraphicGrid.cxx - left constants instead of functions beacuse of faster perfomance.
7) Commented unreachable code in files GeomFill_LocationGuide.cxx and TopOpeBRepTool_mkTondgE.cxx
Affected Issues
0023132
mod - src/BRepFill/BRepFill_OffsetWire.cxx Diff File
mod - src/GeomFill/GeomFill_LocationGuide.cxx Diff File
mod - src/IFSelect/IFSelect_WorkSession.cxx Diff File
mod - src/IntTools/IntTools_EdgeFace.cxx Diff File
mod - src/RWStepBasic/RWStepBasic_RWSiUnitAndAreaUnit.cxx Diff File
mod - src/RWStepBasic/RWStepBasic_RWSiUnitAndLengthUnit.cxx Diff File
mod - src/RWStepBasic/RWStepBasic_RWSiUnitAndMassUnit.cxx Diff File
mod - src/RWStepBasic/RWStepBasic_RWSiUnitAndPlaneAngleUnit.cxx Diff File
mod - src/RWStepBasic/RWStepBasic_RWSiUnitAndRatioUnit.cxx Diff File
mod - src/RWStepBasic/RWStepBasic_RWSiUnitAndSolidAngleUnit.cxx Diff File
mod - src/RWStepBasic/RWStepBasic_RWSiUnitAndThermodynamicTemperatureUnit.cxx Diff File
mod - src/RWStepBasic/RWStepBasic_RWSiUnitAndTimeUnit.cxx Diff File
mod - src/RWStepBasic/RWStepBasic_RWSiUnitAndVolumeUnit.cxx Diff File
mod - src/TopOpeBRep/TopOpeBRep_ShapeIntersector2d.cxx Diff File
mod - src/TopOpeBRepTool/TopOpeBRepTool_mkTondgE.cxx Diff File

Issue History

Date Modified Username Field Change
2012-05-04 01:41 QbProg New Issue
2012-05-04 01:41 QbProg Assigned To => abv
2012-05-04 12:53 abv Note Added: 0020473
2012-05-04 12:53 abv Assigned To abv => dbv
2012-05-04 12:53 abv Status new => assigned
2012-05-04 15:57 QbProg Note Added: 0020478
2012-05-04 16:02 abv Note Added: 0020480
2012-05-06 19:59 QbProg Note Added: 0020489
2012-05-07 09:16 abv Relationship added parent of 0023140
2012-05-07 09:16 abv Relationship added parent of 0023141
2012-05-07 09:17 abv Relationship added parent of 0023142
2012-05-07 09:18 abv Relationship added parent of 0023143
2012-05-07 09:18 abv Relationship added parent of 0023144
2012-05-07 09:18 abv Relationship added parent of 0023145
2012-05-07 09:19 abv Relationship added parent of 0023146
2012-05-07 09:19 abv Relationship added parent of 0023147
2012-05-07 09:21 abv Product Version => 6.5.3
2012-05-07 09:21 abv Target Version => 6.5.4
2012-07-16 16:17 Pawel Relationship added parent of 0023288
2012-07-16 16:25 Pawel Relationship added parent of 0023289
2012-07-16 16:29 Pawel Relationship added parent of 0023290
2012-07-16 16:57 Pawel Relationship added parent of 0023291
2012-07-17 12:56 Pawel Relationship added parent of 0023293
2012-07-17 18:02 Pawel Relationship added parent of 0023309
2012-07-17 19:12 Pawel Relationship added parent of 0023312
2012-10-09 19:01 oan Assigned To dbv => omy
2012-10-19 15:17 omy Note Added: 0021853
2012-10-19 15:17 omy Assigned To omy => oan
2012-10-19 15:17 omy Status assigned => resolved
2012-10-22 11:07 oan Assigned To oan => jgv
2012-10-22 11:09 oan Note Added: 0021873
2012-10-23 16:39 jgv Note Added: 0021908
2012-10-23 16:39 jgv Status resolved => reviewed
2012-10-23 16:46 mkv Assigned To jgv => mkv
2012-10-23 18:41 abv Target Version 6.5.4 => 6.6.0
2012-10-31 18:56 apn Note Added: 0022039
2012-10-31 18:56 apn Test case number => Not needed
2012-10-31 18:56 apn Assigned To mkv => omy
2012-10-31 18:56 apn Status reviewed => assigned
2012-11-08 13:18 omy Note Added: 0022145
2012-11-08 13:18 omy Assigned To omy => apn
2012-11-08 13:18 omy Status assigned => resolved
2012-11-08 13:26 omy Status resolved => reviewed
2012-11-08 18:22 mkv Assigned To apn => mkv
2012-11-09 14:37 mkv Note Added: 0022179
2012-11-09 14:38 mkv Assigned To mkv => bugmaster
2012-11-09 14:38 mkv Status reviewed => tested
2012-11-21 14:39 mkv Note Edited: 0022179
2012-11-22 11:51 mkv Note Added: 0022350
2012-11-26 15:45 omy Changeset attached => occt master 4e76d93b
2012-11-26 15:45 omy Assigned To bugmaster => omy
2012-11-26 15:45 omy Status tested => verified
2012-11-26 15:45 omy Resolution open => fixed
2012-12-10 17:16 omy Changeset attached => occt master 4e76d93b
2013-04-23 13:37 aiv Status verified => closed
2013-04-29 15:21 aiv Fixed in Version => 6.6.0