Tautological comparison (always evaluates to false) (Bug #3510)


Added by Johann Rocholl about 11 years ago. Updated almost 10 years ago.


Status:Done Start date:2014-01-28
Priority:Low Due date:
Assignee:Johann Rocholl % Done:

0%

Category:ml
Target version:-
Affected version:branch '2.4' (2.4-dev) Operating System:Any
Difficulty:Easy HW Platform:Any
Pull request:

Description

https://github.com/Itseez/opencv/blob/bad927325fc9b73ad449fd46f8856a2cea448390/modules/ml/src/tree.cpp#L1448

if( cat_var_count != cat_var_count || ord_var_count != ord_var_count )
CV_ERROR( CV_StsParseError, "var_type is inconsistent with cat_var_count and ord_var_count" );
//////

This code doesn't make sense because the if statement always evaluates to false.
It seems like this is supposed to catch a real issue but the if statement contains a bug.
This was caught by clang's -Wtautological-compare feature.


Associated revisions

Revision 5fea331d
Added by Vadim Pisarevsky about 10 years ago

Merge pull request #3510 from boaz001:feature-4057

History

Updated by Vladislav Vinogradov about 11 years ago

Hello Johann,

Thank you for reporting this issue!

Do you think you can try to fix this issue locally and send us a pull request? Your help would be very appreciated. Please read more details on how to contribute here: http://code.opencv.org/projects/opencv/wiki/How_to_contribute.

  • Priority changed from Normal to Low
  • Assignee changed from Maria Dimashova to Johann Rocholl
  • Status changed from New to Open

Updated by Rick Mann almost 11 years ago

I saw this, too, but couldn't discern how to actually fix it.

Updated by Vadim Pisarevsky almost 10 years ago

I think, the bug has been fixed in 3.0-dev, at least I do not see such a comparison in tree.cpp

  • Status changed from Open to Done

Also available in: Atom PDF