From: Mathias Aparicio <[email protected]>

Before the patch, Get_Upper_Half_Char_Immed and Get_Upper_Half_Char would
both raise a Constraint_Error when the input exceeded a bound. However,
ARM A.13 (13) states that the procedure Get should propagate the
Data_Error exception if the input value does not belong to the range of
the required subtype.

Now propagate Data_Error.

gcc/ada/ChangeLog:

        * libgnat/a-textio.adb
        (Get_Upper_Half_Char, Get_Upper_Half_Char_Immed): Replace
        Constraint_Error with Data_Error

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

---
 gcc/ada/libgnat/a-textio.adb | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/gcc/ada/libgnat/a-textio.adb b/gcc/ada/libgnat/a-textio.adb
index c8e7638f239..52b7b4b4d04 100644
--- a/gcc/ada/libgnat/a-textio.adb
+++ b/gcc/ada/libgnat/a-textio.adb
@@ -100,7 +100,7 @@ is
    --  upper half character value from the given File. The first byte has
    --  already been read and is passed in C. The character value is returned as
    --  the result, and the file pointer is bumped past the character.
-   --  Constraint_Error is raised if the encoded value is outside the bounds of
+   --  Data_Error is raised if the encoded value is outside the bounds of
    --  type Character.
 
    function Get_Upper_Half_Char_Immed
@@ -806,7 +806,7 @@ is
       Result := WC_In (C, File.WC_Method);
 
       if Wide_Character'Pos (Result) > 16#FF# then
-         raise Constraint_Error with
+         raise Data_Error with
            "invalid wide character in Text_'I'O input";
       else
          return Character'Val (Wide_Character'Pos (Result));
@@ -849,7 +849,7 @@ is
       Result := WC_In (C, File.WC_Method);
 
       if Wide_Character'Pos (Result) > 16#FF# then
-         raise Constraint_Error with
+         raise Data_Error with
            "invalid wide character in Text_'I'O input";
       else
          return Character'Val (Wide_Character'Pos (Result));
-- 
2.53.0

Reply via email to