That sounds good to me.
Forgot to mention, running Linux command-line version.
After running cppcheck v1.78 on our codebase, one file caused a seg-fault. The offending file was reduced to the following, and stll caused a seg-fault. Can't quickly try a newer version of cppcheck due to tightly-controlled environment. test101.H: class AlertSvc: public AlertService { std::set<alerthelper_i*> alert_helpers; typedef struct { M_Struct alert_data; short previous; short next; } AlertRecoveryDB; };</alerthelper_i*> test101.C: include "test101.H" void AlertSvc::ClearEntry() { memset(&alert_recovery_database[0],...
I ran the test you supplied above, and I got "inf", too.
FYI, cat /etc/*release displays: Red HatEnterprise Linux Client release 5.5 (Tikanga) 5.4 Redhawk Linux (Lima)
I checked closer, and this error is still getting captured with v1.78, so cppcheck is still behaving the same for this test case, so there is no problem. If there's a moderator, I wouldn't mind if this issue chain were deleted. Since I was wrong, it's just a waste of space, except maybe to serve as a cautionary tale against posting a problem before double-checking your assertions.
OK. I reduced my offending file down to this, and I still get a 'memcpy' on class error with v1.33 but not with v1.78. test26.h: class ItemStruct; class CurrentStruct { bool getNext(ItemStruct *val); }; test26.cpp: #include "test26.h" bool CurrentStruct::getNext(ItemStruct val) { ItemStruct bi = &(*next); memcpy(val, bi, sizeof(ItemStruct)); return true; }
Just upgraded from cppcheck v1.33 to v1.78. The code below was formerly flagged as Divide by zero, but is ignored with v1.78. float rate = 0 float range = 0; rate= 1.1 rate = rate/range;