https://gcc.gnu.org/g:b22da5073d4410a9cce03366692b6b1e80d13119
commit r17-1362-gb22da5073d4410a9cce03366692b6b1e80d13119 Author: Mathias Aparicio <[email protected]> Date: Mon May 18 14:48:48 2026 +0200 ada: Change Constraint_Error into Data_Error in Text_IO to respect ARM 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 Diff: --- 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 c8e7638f239e..52b7b4b4d049 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));
