- error ("coverage mismatch for function '%s' while reading counter '%s'.",
- 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;
+ bool warning_printed = false;
+ tree id = DECL_ASSEMBLER_NAME (current_function_decl);
+
+ warning_printed =
+ warning_at (input_location, OPT_Wcoverage_mismatch,
+ "coverage mismatch for function "
+ "%qE while reading counter %qs", id, ctr_names[counter]);
+ if (warning_printed)
+ {
+ 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 (!(errorcount || sorrycount)
+ && !warned++)
+ {
+ inform (input_location, "coverage mismatch ignored");
+ inform (input_location, flag_guess_branch_prob
+ ? G_("execution counts estimated")
+ : G_("execution counts assumed to be zero"));
+ if (!flag_guess_branch_prob)
+ inform (input_location,
+ "this can result in poorly optimized code");
+ }
+ }
+
+ return NULL;