From b85120adbab0723862baed90c0430b39b2d6b938 Mon Sep 17 00:00:00 2001 From: Arnaud Charlet Date: Wed, 1 Apr 2020 11:46:22 -0400 Subject: [PATCH] [Ada] Allow uninitialized values on Big_Positive/Natural 2020-06-15 Arnaud Charlet gcc/ada/ * libgnat/a-nbnbin.ads (Big_Positive, Big_Natural): Fix predicate. --- gcc/ada/libgnat/a-nbnbin.ads | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/gcc/ada/libgnat/a-nbnbin.ads b/gcc/ada/libgnat/a-nbnbin.ads index 45a7b6e64eb..581e868b899 100644 --- a/gcc/ada/libgnat/a-nbnbin.ads +++ b/gcc/ada/libgnat/a-nbnbin.ads @@ -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 -- 2.30.2