This is the mail archive of the
gcc-prs@gcc.gnu.org
mailing list for the GCC project.
ada/10889: Convention Fortran matrices mishandled in generics
- From: Matthias Klose <doko at net dot local>
- To: gcc-gnats at gcc dot gnu dot org, debian-gcc at lists dot debian dot org
- Date: Tue, 20 May 2003 23:39:39 +0200
- Subject: ada/10889: Convention Fortran matrices mishandled in generics
- Reply-to: 192135 at bugs dot debian dot org
>Number: 10889
>Category: ada
>Synopsis: Convention Fortran matrices mishandled in generics
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: unassigned
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Tue May 20 21:46:00 UTC 2003
>Closed-Date:
>Last-Modified:
>Originator: Duncan Sands <duncan.sands@math.u-psud.fr>
>Release: 3.3 (Debian) (Debian testing/unstable)
>Organization:
The Debian Project
>Environment:
System: Debian GNU/Linux (unstable)
Architecture: i686
>Description:
[ Reported to the Debian BTS as report #192135.
Please CC 192135@bugs.debian.org on replies.
Log of report can be found at http://bugs.debian.org/192135 ]
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;
>How-To-Repeat:
>Fix:
>Release-Note:
>Audit-Trail:
>Unformatted: