Bug#192135: gnat-3.3: Convention Fortran matrices mishandled in generics
Package: gnat-3.3
Version: 1:3.3-0pre7
Severity: normal
Consider the following test program. It prints out
the matrix A twice, using identical code. However
the second copy of the code is wrapped up in a
generic. Notice how the rows and columns are swapped
in the second print out? This only occurs when the
matrix is declared to be of convention Fortran. This
bug is present in 3.14p to current 3.3.
All the best,
Duncan.
with Ada.Text_IO; use Ada.Text_IO;
procedure Bug is
subtype Index is Integer range 1 .. 2;
type Matrix is array (Index, Index) of Integer;
pragma Convention (Fortran, Matrix);
generic
type Matrix is array (Index, Index) of Integer;
procedure Print_Out (A : Matrix);
procedure Print_Out (A : Matrix) is
begin
for I in A'Range (1) loop
for J in A'Range (2) loop
Put (Integer'Image (A (I, J)));
end loop;
New_Line;
end loop;
end Print_Out;
procedure Print is new Print_Out (Matrix);
A : Matrix;
begin
for I in A'Range (1) loop
for J in A'Range (2) loop
A (I, J) := 10 * I + J;
end loop;
end loop;
for I in A'Range (1) loop
for J in A'Range (2) loop
Put (Integer'Image (A (I, J)));
end loop;
New_Line;
end loop;
New_Line;
Print (A);
end Bug;
-- System Information:
Debian Release: testing/unstable
Architecture: i386
Kernel: Linux baldrick 2.4.21-rc1 #1 Fri Apr 25 09:22:17 CEST 2003 i686
Locale: LANG=C, LC_CTYPE=C
Versions of packages gnat-3.3 depends on:
ii gcc-3.3 1:3.3-0pre7 The GNU C compiler
ii gcc-3.3-base 1:3.3-0pre7 The GNU Compiler Collection (base
ii libc6 2.3.1-17 GNU C Library: Shared libraries an
-- no debconf information
Reply to: