Backport r247375

2017-06-22  Martin Liska  <mliska@suse.cz>

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

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

From-SVN: r249541
This commit is contained in:
Martin Liska 2017-06-22 13:37:13 +02:00 committed by Martin Liska
parent ed4635ea72
commit 2f5b8b6d6f
2 changed files with 15 additions and 0 deletions

View File

@ -1,3 +1,11 @@
2017-06-22 Martin Liska <mliska@suse.cz>
Backport from mainline
2017-04-28 Martin Liska <mliska@suse.cz>
PR gcov-profile/53915
* gcov.c (format_gcov): Print 'NAN %' when top > bottom.
2017-06-22 Martin Liska <mliska@suse.cz>
Backport from mainline

View File

@ -1959,6 +1959,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;