From 9a4463ea5a30547f306f9df07da2885d6c606161 Mon Sep 17 00:00:00 2001 From: charlet Date: Tue, 6 Jan 2015 10:01:05 +0000 Subject: 2015-01-06 Robert Dewar * snames.ads-tmpl: Remove entries for attribute Enum_Image. * exp_attr.adb: Remove reference to Attribute_Enum_Image. 2015-01-06 Robert Dewar * 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 * sem_prag.adb (Process_Inline): Remove redundant construct warning (-gnatw.r) for an ineffective pragma Inline. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@219244 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ada/s-vallli.adb | 28 +++++++++++++++++++++++----- 1 file changed, 23 insertions(+), 5 deletions(-) (limited to 'gcc/ada/s-vallli.adb') diff --git a/gcc/ada/s-vallli.adb b/gcc/ada/s-vallli.adb index 203e475b3cf..bf0e15d1234 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; -- cgit v1.2.1