PR25244, --print-memory-usage, division by zero if MEMORY length is zero

Alan Modra amodra@gmail.com
Thu Dec 5 11:20:00 GMT 2019


Do print the linefeed when length is zero.

	PR 25244
	* ldlang.c (lang_print_memory_usage): Correct last patch.

diff --git a/ld/ldlang.c b/ld/ldlang.c
index bb3cd91215..05ea0c881f 100644
--- a/ld/ldlang.c
+++ b/ld/ldlang.c
@@ -9281,7 +9281,8 @@ lang_print_memory_usage (void)
       if (r->length != 0)
 	{
 	  double percent = used_length * 100.0 / r->length;
-	  printf ("    %6.2f%%\n", percent);
+	  printf ("    %6.2f%%", percent);
 	}
+      printf ("\n");
     }
 }

-- 
Alan Modra
Australia Development Lab, IBM



More information about the Binutils mailing list