aboutsummaryrefslogtreecommitdiff
path: root/gcc/ada
diff options
context:
space:
mode:
authorThomas Quinot <quinot@adacore.com>2007-12-13 11:32:56 +0100
committerArnaud Charlet <charlet@gcc.gnu.org>2007-12-13 11:32:56 +0100
commit968d9db361c8ab89f77a12fdedff6b93cbbe4d85 (patch)
treeaee396e06b162d38463f8a0c90e42ccb324f15f5 /gcc/ada
parent7f0e4cdb55e96a7ca4ed9b39b6881f27de56e6e7 (diff)
downloadgcc-968d9db361c8ab89f77a12fdedff6b93cbbe4d85.zip
gcc-968d9db361c8ab89f77a12fdedff6b93cbbe4d85.tar.gz
gcc-968d9db361c8ab89f77a12fdedff6b93cbbe4d85.tar.bz2
sinput.adb (Get_Source_File_Index): Add assertion to guard against an invalid access to an uninitialized slot in...
2007-12-06 Thomas Quinot <quinot@adacore.com> * sinput.adb (Get_Source_File_Index): Add assertion to guard against an invalid access to an uninitialized slot in the Source_File_Index_Table. From-SVN: r130860
Diffstat (limited to 'gcc/ada')
-rw-r--r--gcc/ada/sinput.adb16
1 files changed, 8 insertions, 8 deletions
diff --git a/gcc/ada/sinput.adb b/gcc/ada/sinput.adb
index 616b73d..bafde45 100644
--- a/gcc/ada/sinput.adb
+++ b/gcc/ada/sinput.adb
@@ -366,22 +366,22 @@ package body Sinput is
Source_Cache_First : Source_Ptr := 1;
Source_Cache_Last : Source_Ptr := 0;
-- Records the First and Last subscript values for the most recently
- -- referenced entry in the source table, to optimize the common case
- -- of repeated references to the same entry. The initial values force
- -- an initial search to set the cache value.
+ -- referenced entry in the source table, to optimize the common case of
+ -- repeated references to the same entry. The initial values force an
+ -- initial search to set the cache value.
Source_Cache_Index : Source_File_Index := No_Source_File;
-- Contains the index of the entry corresponding to Source_Cache
- function Get_Source_File_Index
- (S : Source_Ptr)
- return Source_File_Index
- is
+ function Get_Source_File_Index (S : Source_Ptr) return Source_File_Index is
begin
if S in Source_Cache_First .. Source_Cache_Last then
return Source_Cache_Index;
else
+ pragma Assert (Source_File_Index_Table (Int (S) / Chunk_Size)
+ /=
+ No_Source_File);
for J in Source_File_Index_Table (Int (S) / Chunk_Size)
.. Source_File.Last
loop
@@ -811,7 +811,7 @@ package body Sinput is
begin
-- For the instantiation case, we do not read in any data. Instead
-- we share the data for the generic template entry. Since the
- -- template always occurs first, we can safetly refer to its data.
+ -- template always occurs first, we can safely refer to its data.
if S.Instantiation /= No_Location then
declare