aboutsummaryrefslogtreecommitdiff
path: root/gcc/ada/s-vallli.adb
diff options
context:
space:
mode:
authorRobert Dewar <dewar@adacore.com>2015-01-06 10:01:05 +0000
committerArnaud Charlet <charlet@gcc.gnu.org>2015-01-06 11:01:05 +0100
commit61ae296d2beb645bd0aed720cf408891d67913d9 (patch)
tree6f7793841c4e1fcde4c33c02fe46029e82f1af2e /gcc/ada/s-vallli.adb
parent21db8699c3896ec0f4acba2a008874592832bdab (diff)
downloadgcc-61ae296d2beb645bd0aed720cf408891d67913d9.zip
gcc-61ae296d2beb645bd0aed720cf408891d67913d9.tar.gz
gcc-61ae296d2beb645bd0aed720cf408891d67913d9.tar.bz2
snames.ads-tmpl: Remove entries for attribute Enum_Image.
2015-01-06 Robert Dewar <dewar@adacore.com> * snames.ads-tmpl: Remove entries for attribute Enum_Image. * exp_attr.adb: Remove reference to Attribute_Enum_Image. 2015-01-06 Robert Dewar <dewar@adacore.com> * s-vallli.adb (Value_Long_Long_Integer): Handle case of Str'Last = Positive'Last. * s-valllu.adb (Value_Long_Long_Unsigned): Handle case of Str'Last = Positive'Last. 2015-01-06 Robert Dewar <dewar@adacore.com> * sem_prag.adb (Process_Inline): Remove redundant construct warning (-gnatw.r) for an ineffective pragma Inline. From-SVN: r219244
Diffstat (limited to 'gcc/ada/s-vallli.adb')
-rw-r--r--gcc/ada/s-vallli.adb28
1 files changed, 23 insertions, 5 deletions
diff --git a/gcc/ada/s-vallli.adb b/gcc/ada/s-vallli.adb
index 203e475..bf0e15d 100644
--- a/gcc/ada/s-vallli.adb
+++ b/gcc/ada/s-vallli.adb
@@ -91,12 +91,30 @@ package body System.Val_LLI is
-----------------------------
function Value_Long_Long_Integer (Str : String) return Long_Long_Integer is
- V : Long_Long_Integer;
- P : aliased Integer := Str'First;
begin
- V := Scan_Long_Long_Integer (Str, P'Access, Str'Last);
- Scan_Trailing_Blanks (Str, P);
- return V;
+ -- We have to special case Str'Last = Positive'Last because the normal
+ -- circuit ends up setting P to Str'Last + 1 which is out of bounds. We
+ -- deal with this by converting to a subtype which fixes the bounds.
+
+ if Str'Last = Positive'Last then
+ declare
+ subtype NT is String (1 .. Str'Length);
+ begin
+ return Value_Long_Long_Integer (NT (Str));
+ end;
+
+ -- Normal case where Str'Last < Positive'Last
+
+ else
+ declare
+ V : Long_Long_Integer;
+ P : aliased Integer := Str'First;
+ begin
+ V := Scan_Long_Long_Integer (Str, P'Access, Str'Last);
+ Scan_Trailing_Blanks (Str, P);
+ return V;
+ end;
+ end if;
end Value_Long_Long_Integer;
end System.Val_LLI;