[Bug ada/23836] New: Invalid code generated
james at recherche dot enac dot fr
gcc-bugzilla@gcc.gnu.org
Mon Sep 12 16:45:00 GMT 2005
The gnat 4.0 compiler generates invalid code for the following program.
The output of the program is
1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
which is of course not right...
If line labelled 1 is removed and replaced by line labelled 2, the output is
correct.
The output is also correct if part 1 is replaced by part 2, while both parts are
semanticaly identical.It must also be noted that the overlay is only declared
and never used. The code is OK with gnat 3.4
Command passed by gnat to gcc:
gcc-4.0 -c toto.adb
Result of gcc -v:
Using built-in specs.
Target: i486-linux-gnu
Configured with: ../src/configure -v
--enable-languages=c,c++,java,f95,objc,ada,treelang --prefix=/usr
--enable-shared --with-system-zlib --libexecdir=/usr/lib --enable-nls
--without-included-gettext --enable-threads=posix --program-suffix=-4.0
--enable-__cxa_atexit --enable-libstdcxx-allocator=mt --enable-clocale=gnu
--enable-libstdcxx-debug --enable-java-gc=boehm --enable-java-awt=gtk
--enable-gtk-cairo --with-java-home=/usr/lib/jvm/java-1.4.2-gcj-4.0-1.4.2.0/jre
--enable-mpfr --disable-werror --enable-checking=release i486-linux-gnu
Thread model: posix
gcc version 4.0.2 20050821 (prerelease) (Debian 4.0.1-6)
ADA program:
with Text_Io;
use Text_Io;
with Interfaces;
use Interfaces;
procedure Toto is
type Intboard is new Unsigned_64;
for Intboard'Size use 64;
type Bit is new Integer range 0..1;
for Bit'Size use 1;
type Bitboard is array (0..63) of Bit;
pragma Pack(Bitboard);
for Bitboard'Size use 64;
A_B : Bitboard;
A_I : Intboard;
for A_I'Address use A_B'Address; --label1
-- for A_B'Address use A_I'Address; --label2
begin
--part 1
for I in 0 .. 7 loop
for J in 0 .. 7 loop
A_B(I*8+J) := 1;
Put(Bit'Image(A_B(I*8+J)));
end loop;
end loop;
--part 2
-- for I in 0 .. 63 loop
-- A_B(I) := 1;
-- Put(Bit'Image(A_B(I)));
-- end loop;
end Toto;
--
Summary: Invalid code generated
Product: gcc
Version: 4.0.2
Status: UNCONFIRMED
Severity: normal
Priority: P2
Component: ada
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: james at recherche dot enac dot fr
CC: gcc-bugs at gcc dot gnu dot org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=23836
More information about the Gcc-bugs
mailing list