diff options
Diffstat (limited to 'gcc/ada/s-wchcnv.adb')
-rw-r--r-- | gcc/ada/s-wchcnv.adb | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/gcc/ada/s-wchcnv.adb b/gcc/ada/s-wchcnv.adb index bb806f08aa5..893232e605a 100644 --- a/gcc/ada/s-wchcnv.adb +++ b/gcc/ada/s-wchcnv.adb @@ -284,6 +284,14 @@ package body System.WCh_Cnv is U : Unsigned_32; begin + -- Raise CE for invalid UTF_32_Code + + if not Val'Valid then + raise Constraint_Error; + end if; + + -- Processing depends on encoding mode + case EM is when WCEM_Hex => @@ -425,10 +433,6 @@ package body System.WCh_Cnv is if Val > 16#FFFF# then if Val > 16#00FF_FFFF# then - if Val > 16#7FFF_FFFF# then - raise Constraint_Error; - end if; - Out_Char (Hexc (Val / 16 ** 7)); Out_Char (Hexc ((Val / 16 ** 6) mod 16)); end if; |