- error ("coverage mismatch for function %qs while reading counter %qs",
- IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (current_function_decl)),
- ctr_names[counter]);
- error ("number of counters is %d instead of %d", entry->summary.num, expected);
- return 0;
+ static int warned = 0;
+ const char *id = IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME
+ (current_function_decl));
+
+ if (warn_coverage_mismatch)
+ warning (OPT_Wcoverage_mismatch, "coverage mismatch for function "
+ "%qs while reading counter %qs", id, ctr_names[counter]);
+ else
+ error ("coverage mismatch for function %qs while reading counter %qs",
+ id, ctr_names[counter]);
+
+ if (!inhibit_warnings)
+ {
+ if (entry->checksum != checksum)
+ inform (input_location, "checksum is %x instead of %x", entry->checksum, checksum);
+ else
+ inform (input_location, "number of counters is %d instead of %d",
+ entry->summary.num, expected);
+ }
+
+ if (warn_coverage_mismatch
+ && !inhibit_warnings
+ && !warned++)
+ {
+ inform (input_location, "coverage mismatch ignored due to -Wcoverage-mismatch");
+ inform (input_location, flag_guess_branch_prob
+ ? "execution counts estimated"
+ : "execution counts assumed to be zero");
+ if (!flag_guess_branch_prob)
+ inform (input_location, "this can result in poorly optimized code");
+ }
+
+ return NULL;