]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
ada: Apply tweak for machine-code-based coverage
authorRonan Desplanques <desplanques@adacore.com>
Mon, 7 Apr 2025 08:19:24 +0000 (10:19 +0200)
committerMarc Poulhiès <dkm@gcc.gnu.org>
Thu, 12 Jun 2025 08:37:56 +0000 (10:37 +0200)
gcc/ada/ChangeLog:

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

gcc/ada/libgnat/s-valuer.adb

index 2410b6bd4e14d69d4b11299535da739805bf0fcb..cc1f778ee4ee712f4bfca85a214c73a57de5f67e 100644 (file)
@@ -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;