summaryrefslogtreecommitdiff
path: root/gcc/ada
diff options
context:
space:
mode:
authorcharlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4>2006-02-15 09:32:25 +0000
committercharlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4>2006-02-15 09:32:25 +0000
commit165633c00f7ebfd93f2da18eda1f8686b3818de3 (patch)
treeb2c80f9b972763c47d1781393bcc7b3fcafa9747 /gcc/ada
parentec677a6c3a40284ccffa6de052697c0f56bc92d3 (diff)
downloadgcc-165633c00f7ebfd93f2da18eda1f8686b3818de3.tar.gz
* a-stwisu.adb, a-strsup.adb, a-stzsup.adb (Super_Slice): Fix slice
index. * a-stwima.adb (To_Set): Add extra check when N = 0. * g-regpat.adb: (Match_Simple_Operator): Avoid possible overflow. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@111033 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/ada')
-rw-r--r--gcc/ada/a-strsup.adb6
-rw-r--r--gcc/ada/a-stwisu.adb6
-rw-r--r--gcc/ada/a-stzsup.adb6
-rw-r--r--gcc/ada/g-regpat.adb14
4 files changed, 17 insertions, 15 deletions
diff --git a/gcc/ada/a-strsup.adb b/gcc/ada/a-strsup.adb
index 1b1c9090c92..a53a94d5e41 100644
--- a/gcc/ada/a-strsup.adb
+++ b/gcc/ada/a-strsup.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 2003-2005, Free Software Foundation, Inc. --
+-- Copyright (C) 2003-2006, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -1471,7 +1471,7 @@ package body Ada.Strings.Superbounded is
raise Index_Error;
else
Result.Current_Length := High - Low + 1;
- Result.Data (1 .. Source.Current_Length) := Source.Data (Low .. High);
+ Result.Data (1 .. Result.Current_Length) := Source.Data (Low .. High);
end if;
return Result;
@@ -1490,7 +1490,7 @@ package body Ada.Strings.Superbounded is
raise Index_Error;
else
Target.Current_Length := High - Low + 1;
- Target.Data (1 .. Source.Current_Length) := Source.Data (Low .. High);
+ Target.Data (1 .. Target.Current_Length) := Source.Data (Low .. High);
end if;
end Super_Slice;
diff --git a/gcc/ada/a-stwisu.adb b/gcc/ada/a-stwisu.adb
index 5984e5e117f..ad15f3db08c 100644
--- a/gcc/ada/a-stwisu.adb
+++ b/gcc/ada/a-stwisu.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 2003-2005, Free Software Foundation, Inc. --
+-- Copyright (C) 2003-2006, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -1474,7 +1474,7 @@ package body Ada.Strings.Wide_Superbounded is
raise Index_Error;
else
Result.Current_Length := High - Low + 1;
- Result.Data (1 .. Source.Current_Length) := Source.Data (Low .. High);
+ Result.Data (1 .. Result.Current_Length) := Source.Data (Low .. High);
end if;
return Result;
@@ -1493,7 +1493,7 @@ package body Ada.Strings.Wide_Superbounded is
raise Index_Error;
else
Target.Current_Length := High - Low + 1;
- Target.Data (1 .. Source.Current_Length) := Source.Data (Low .. High);
+ Target.Data (1 .. Target.Current_Length) := Source.Data (Low .. High);
end if;
end Super_Slice;
diff --git a/gcc/ada/a-stzsup.adb b/gcc/ada/a-stzsup.adb
index 9e4fbcd20f1..6b8e710f2f9 100644
--- a/gcc/ada/a-stzsup.adb
+++ b/gcc/ada/a-stzsup.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 2003-2005, Free Software Foundation, Inc. --
+-- Copyright (C) 2003-2006, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -1481,7 +1481,7 @@ package body Ada.Strings.Wide_Wide_Superbounded is
raise Index_Error;
else
Result.Current_Length := High - Low + 1;
- Result.Data (1 .. Source.Current_Length) := Source.Data (Low .. High);
+ Result.Data (1 .. Result.Current_Length) := Source.Data (Low .. High);
end if;
return Result;
@@ -1500,7 +1500,7 @@ package body Ada.Strings.Wide_Wide_Superbounded is
raise Index_Error;
else
Target.Current_Length := High - Low + 1;
- Target.Data (1 .. Source.Current_Length) := Source.Data (Low .. High);
+ Target.Data (1 .. Target.Current_Length) := Source.Data (Low .. High);
end if;
end Super_Slice;
diff --git a/gcc/ada/g-regpat.adb b/gcc/ada/g-regpat.adb
index c52b5f2c894..6bfc2d9f3e3 100644
--- a/gcc/ada/g-regpat.adb
+++ b/gcc/ada/g-regpat.adb
@@ -7,7 +7,7 @@
-- B o d y --
-- --
-- Copyright (C) 1986 by University of Toronto. --
--- Copyright (C) 1999-2005, AdaCore --
+-- Copyright (C) 1999-2006, AdaCore --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -2878,12 +2878,14 @@ package body GNAT.Regpat is
if Next_Char_Known then
-- Last position to check
- Last_Pos := Input_Pos + Max;
-
- if Last_Pos > Last_In_Data
- or else Max = Natural'Last
- then
+ if Max = Natural'Last then
Last_Pos := Last_In_Data;
+ else
+ Last_Pos := Input_Pos + Max;
+
+ if Last_Pos > Last_In_Data then
+ Last_Pos := Last_In_Data;
+ end if;
end if;
-- Look for the first possible opportunity