[Ada] Allow uninitialized values on Big_Positive/Natural
authorArnaud Charlet <charlet@adacore.com>
Wed, 1 Apr 2020 15:46:22 +0000 (11:46 -0400)
committerPierre-Marie de Rodat <derodat@adacore.com>
Mon, 15 Jun 2020 08:04:37 +0000 (04:04 -0400)
2020-06-15  Arnaud Charlet  <charlet@adacore.com>

gcc/ada/

* libgnat/a-nbnbin.ads (Big_Positive, Big_Natural): Fix
predicate.

gcc/ada/libgnat/a-nbnbin.ads

index 45a7b6e..581e868 100644 (file)
@@ -46,11 +46,15 @@ is
    function To_Big_Integer (Arg : Integer) return Big_Integer;
 
    subtype Big_Positive is Big_Integer
-     with Dynamic_Predicate => Big_Positive > To_Big_Integer (0),
+     with Dynamic_Predicate =>
+            (if Is_Valid (Big_Positive)
+             then Big_Positive > To_Big_Integer (0)),
           Predicate_Failure => (raise Constraint_Error);
 
    subtype Big_Natural is Big_Integer
-     with Dynamic_Predicate => Big_Natural >= To_Big_Integer (0),
+     with Dynamic_Predicate =>
+            (if Is_Valid (Big_Natural)
+             then Big_Natural >= To_Big_Integer (0)),
           Predicate_Failure => (raise Constraint_Error);
 
    function In_Range (Arg, Low, High : Big_Integer) return Boolean is