From: Ronan Desplanques <desplanq...@adacore.com>

gcc/ada/ChangeLog:

        * libgnat/s-valuer.adb (Scan_Raw_Real): Apply tweak.

Tested on x86_64-pc-linux-gnu, committed on master.

---
 gcc/ada/libgnat/s-valuer.adb | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/gcc/ada/libgnat/s-valuer.adb b/gcc/ada/libgnat/s-valuer.adb
index 2410b6bd4e1..cc1f778ee4e 100644
--- a/gcc/ada/libgnat/s-valuer.adb
+++ b/gcc/ada/libgnat/s-valuer.adb
@@ -614,7 +614,13 @@ package body System.Value_R is
       then
          Base_Char := Str (Index);
 
-         if N = 1 and then Value (1) in 2 .. 16 then
+         --  Functionally, "(Parts = 1 or else N = 1)" in the condition of the
+         --  following if statement could replaced by the simpler "N = 1". The
+         --  reason we use a more complicated expression is to accommodate
+         --  machine-code-based coverage tools: the simple version makes it
+         --  impossible to fully cover generic instances of System.Value_R with
+         --  Parts = 1.
+         if (Parts = 1 or else N = 1) and then Value (1) in 2 .. 16 then
             Base := Unsigned (Value (1));
          else
             Base_Violation := True;
-- 
2.43.0

Reply via email to