summaryrefslogtreecommitdiff
path: root/gcc/ada/s-wchcnv.adb
diff options
context:
space:
mode:
authorcharlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4>2009-06-19 10:54:36 +0000
committercharlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4>2009-06-19 10:54:36 +0000
commitd4b026c15fdd0957de6d579ec01628981ade8fdd (patch)
tree3dc69a796350c5398ef3695ee47179b993e295a9 /gcc/ada/s-wchcnv.adb
parent64cdcce7804020ce87ad330052dd25eeb5d0a3ca (diff)
downloadgcc-d4b026c15fdd0957de6d579ec01628981ade8fdd.tar.gz
2009-06-19 Robert Dewar <dewar@adacore.com>
* sem_type.ads, sem_ch12.adb: Minor reformatting * s-wchcnv.adb (UTF_32_To_Char_Sequence): Handle invalid data properly 2009-06-19 Ed Schonberg <schonberg@adacore.com> * exp_ch9.adb (Build_Wrapper_Spec): Handle properly an overridden primitive operation of a rivate extension whose controlling argument is an out parameter. * sem.adb (Walk_Library_Units): exclude generic package declarations from check. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@148696 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/ada/s-wchcnv.adb')
-rw-r--r--gcc/ada/s-wchcnv.adb12
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;