Location
File: cpp/ReportPrintConditionalDV.cpp:762
Function: Report::printConditional_DV()
Issue
Variables test_by_fit_rule and test_by_test_rule are used with += operator in a loop without prior initialization.
Code
double test_by_fit_rule, test_by_test_rule; // Line 762: declared but not initialized
// Later in code (lines 765-773):
for (int i = 0; i < iv_statespace; i++) {
// ...
test_by_fit_rule += test_freq[i][fit_rule[i]]; // Line 772: += on uninitialized
test_by_test_rule += test_freq[i][test_rule[i]]; // Line 773: += on uninitialized
}
// Line 1095-1096: Used in calculation
fit_percent_on_test = test_by_fit_rule / test_sample_size * 100.0;
best_percent_on_test = test_by_test_rule / test_sample_size * 100.0;
Risk
High - Undefined behavior if iv_statespace is zero or if loop doesn't execute. Results in incorrect statistics calculations.
Recommended Fix
double test_by_fit_rule = 0.0, test_by_test_rule = 0.0;
Reference
See docs/compiler-warning-analysis.md for detailed analysis (Category 4: Test Statistics).
Priority: High
Type: Bug - Undefined Behavior
Location
File:
cpp/ReportPrintConditionalDV.cpp:762Function:
Report::printConditional_DV()Issue
Variables
test_by_fit_ruleandtest_by_test_ruleare used with+=operator in a loop without prior initialization.Code
Risk
High - Undefined behavior if
iv_statespaceis zero or if loop doesn't execute. Results in incorrect statistics calculations.Recommended Fix
Reference
See
docs/compiler-warning-analysis.mdfor detailed analysis (Category 4: Test Statistics).Priority: High
Type: Bug - Undefined Behavior