This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug ada/33994] New: wrong code for indexed component when index subtype has 'Size > 32
- From: "bauhaus at futureapps dot de" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 4 Nov 2007 22:54:14 -0000
- Subject: [Bug ada/33994] New: wrong code for indexed component when index subtype has 'Size > 32
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
The given program can be translated and run and it then produces
incorrect results (details below). Indeed, some circuits from the
GNAT front end seem to indicate an error (use debugging
switch -gnatdF to see this). Also, using -fstack-check adds
a warning that a frame is too large.
The assembly listing shows -1 off %ebp for the second
pair of assigments to Fst/Lst, this seems wrong.
The pairs of consequtive instructions correspond to
assignments in the respective blocks:
movb $33, -10002(%ebp)
movb $63, -2(%ebp)
...
movb $33, -1(%ebp)
movb $63, -1(%ebp)
$ ./too_big
!?
??
To reproduce,
$ gnatmake -save-temps -gnata -gnato -gnatwa -S too_big.adb
with Ada.Text_IO;
procedure Too_Big is
use Ada;
type Big_Index is range 0 .. 2**50;
type A is array (Big_Index range <>) of Character;
begin
-- output is "!?"
declare
X: A (Big_Index range 2**40 .. 2**40 + 10_000);
Fst: Character renames X(X'First);
Lst: Character renames X(X'Last);
begin
Fst := '!';
Lst := '?';
Text_IO.Put(Fst);
Text_IO.Put(Lst);
Text_IO.New_Line;
end;
-- output is "??"
declare
X: A (Big_Index range 2**40 .. 2**48);
Fst: Character renames X(X'First);
Lst: Character renames X(X'Last);
begin
Fst := '!';
Lst := '?';
pragma assert(Fst = '!');
Text_IO.Put(Fst);
Text_IO.Put(Lst);
Text_IO.New_Line;
end;
end Too_Big;
--
Summary: wrong code for indexed component when index subtype has
'Size > 32
Product: gcc
Version: 4.3.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: ada
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: bauhaus at futureapps dot de
GCC build triplet: i686-pc-linux-gnu
GCC host triplet: i686-pc-linux-gnu
GCC target triplet: i686-pc-linux-gnu
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33994