This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug ada/30803] New: warning: index for "X" may assume lower bound of 1
- From: "krischik at users dot sourceforge dot net" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 15 Feb 2007 07:25:35 -0000
- Subject: [Bug ada/30803] New: warning: index for "X" may assume lower bound of 1
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
Hello,
When compiling "gcc-4.2-20070207" I get the following warning (which is treated
as error and):
------------------
comperr.adb:182:30: warning: index for "X" may assume lower bound of 1
comperr.adb:182:30: warning: suggested replacement: "X'First"
comperr.adb:185:48: warning: index for "X" may assume lower bound of 1
comperr.adb:185:48: warning: suggest replacement of "X'Length" by "X'Last"
------------------
Well this is a pretty simple problem - the warning and the suggested
replacement are right. So just replace the line 182 to 185:
------------------
Write_Str (X (1 .. Last_Blank));
End_Line;
Write_Str ("| ");
Write_Str (X (Last_Blank + 1 .. X'Length));
------------------
with
------------------
Write_Str (X (X'First .. Last_Blank));
End_Line;
Write_Str ("| ");
Write_Str (X (Last_Blank + 1 .. X'Last));
------------------
If you can't reproduce the warning remember that GNAT warnings depend on the
compiler version.
Martin
--
Summary: warning: index for "X" may assume lower bound of 1
Product: gcc
Version: 4.2.0
Status: UNCONFIRMED
Severity: trivial
Priority: P3
Component: ada
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: krischik at users dot sourceforge dot net
GCC build triplet: pentium4-pc-mingw32msv
GCC host triplet: pentium4-pc-mingw32msv
GCC target triplet: pentium4-pc-mingw32msv
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=30803