Commit 07ea19a7 by Martin Liska Committed by Martin Liska

Fix format_gcov to not print misleading values (PR gcov-profile/53915)

2017-04-28  Martin Liska  <mliska@suse.cz>

	PR gcov-profile/53915
	* gcov.c (format_gcov): Print 'NAN %' when top > bottom.

From-SVN: r247375
parent 6e49961c
2017-04-28 Martin Liska <mliska@suse.cz>
PR gcov-profile/53915
* gcov.c (format_gcov): Print 'NAN %' when top > bottom.
2017-04-28 Martin Liska <mliska@suse.cz>
PR gcov-profile/79891
* gcov.c (add_line_counts): Assign BBs to lines just if the BB
is marked by compiler as living on a line.
......
......@@ -1946,6 +1946,13 @@ format_gcov (gcov_type top, gcov_type bottom, int dp)
{
static char buffer[20];
/* Handle invalid values that would result in a misleading value. */
if (bottom != 0 && top > bottom && dp >= 0)
{
sprintf (buffer, "NAN %%");
return buffer;
}
if (dp >= 0)
{
float ratio = bottom ? (float)top / bottom : 0;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment