[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Convention Fortran matrices mishandled in generics



>Submitter-Id:	net
>Originator:	Duncan Sands <duncan.sands@math.u-psud.fr>
>Organization:	The Debian Project
>Confidential:	no
>Synopsis:
>Severity:	serious
>Priority:	medium
>Category:	ada
>Class:		sw-bug
>Release:	3.3 (Debian) (Debian testing/unstable)
>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:
	



Reply to: