Which is a false positive, caused by a confusion on the expanded code
for pragma Loop_Variant.

Tested on x86_64-pc-linux-gnu, committed on trunk

gcc/ada/

        * libgnat/s-widthu.adb: Add pragma Annotate.
diff --git a/gcc/ada/libgnat/s-widthu.adb b/gcc/ada/libgnat/s-widthu.adb
--- a/gcc/ada/libgnat/s-widthu.adb
+++ b/gcc/ada/libgnat/s-widthu.adb
@@ -134,10 +134,13 @@ begin
          W := W + 1;
          Pow := Pow * 10;
 
-         pragma Loop_Variant (Decreases => T);
          pragma Loop_Invariant (W in 3 .. Max_W + 3);
          pragma Loop_Invariant (Pow = Big_10 ** (W - 2));
          pragma Loop_Invariant (Big (T) = Big (T_Init) / Pow);
+         pragma Loop_Variant (Decreases => T);
+         pragma Annotate
+           (CodePeer, False_Positive,
+            "validity check", "confusion on generated code");
       end loop;
 
       declare


Reply via email to