summaryrefslogtreecommitdiff
path: root/gcc/ada/a-suenst.adb
diff options
context:
space:
mode:
authorcharlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4>2014-01-27 16:54:37 +0000
committercharlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4>2014-01-27 16:54:37 +0000
commit8f3b5017c4f49ebbacda56a6eeb17f9735582a0e (patch)
treed7021741bf39c55d0e737810af9bddd5a46496fe /gcc/ada/a-suenst.adb
parent3c9851e9c8e2913859171354644e3ca4062e34c8 (diff)
downloadgcc-8f3b5017c4f49ebbacda56a6eeb17f9735582a0e.tar.gz
2014-01-27 Tristan Gingold <gingold@adacore.com>
* exp_ch7.adb, exp_ch9.adb: Adjust comments. 2014-01-27 Robert Dewar <dewar@adacore.com> * exp_ch4.adb (Expand_N_Op_Expon): Remove unsigned type test for 2**X optimization. 2014-01-27 Ed Schonberg <schonberg@adacore.com> * a-suenst.adb: strings.utf_encoding.strings (Decode): Check explicitly whether value is in range of Character, because the library is typically compiled with range checks disabled, and we cannot rely on the implicit check on the argument of 'Val. 2014-01-27 Vincent Celier <celier@adacore.com> * a-ciorma.adb, a-cihama.adb (Assign): Copy the Source to the Target, not the Target to itself. 2014-01-27 Robert Dewar <dewar@adacore.com> * vms_conv.ads, ali.adb, sem_ch6.ads, opt.ads, vms_cmds.ads: Minor changes to avoid incorrect use of unordered enum types. 2014-01-27 Thomas Quinot <quinot@adacore.com> * sem_ch4.adb: Minor reformatting. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@207144 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/ada/a-suenst.adb')
-rw-r--r--gcc/ada/a-suenst.adb15
1 files changed, 9 insertions, 6 deletions
diff --git a/gcc/ada/a-suenst.adb b/gcc/ada/a-suenst.adb
index 87e5893f16b..2ed5c2c0c6c 100644
--- a/gcc/ada/a-suenst.adb
+++ b/gcc/ada/a-suenst.adb
@@ -154,16 +154,19 @@ package body Ada.Strings.UTF_Encoding.Strings is
end if;
Len := Len + 1;
+
+ -- The value may still be out of range of Standard.Character. We make
+ -- the check explicit because the library is typically compiled with
+ -- range checks disabled.
+
+ if R > Character'Pos (Character'Last) then
+ Raise_Encoding_Error (Iptr - 1);
+ end if;
+
Result (Len) := Character'Val (R);
end loop;
return Result (1 .. Len);
-
- exception
- -- 'Val may have been out of range
-
- when others =>
- Raise_Encoding_Error (Iptr - 1);
end Decode;
-- Decode UTF-16 input to String