aboutsummaryrefslogtreecommitdiff
path: root/gcc/gcov.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/gcov.c')
-rw-r--r--gcc/gcov.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/gcc/gcov.c b/gcc/gcov.c
index b25464e..924a5a3 100644
--- a/gcc/gcov.c
+++ b/gcc/gcov.c
@@ -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;