public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
From: Matthias Klose <doko@net.local>
To: gcc-gnats@gcc.gnu.org, debian-gcc@lists.debian.org
Subject: ada/10889: Convention Fortran matrices mishandled in generics
Date: Tue, 20 May 2003 21:46:00 -0000	[thread overview]
Message-ID: <E19IEpf-0003cY-7y@tango.net.local> (raw)


>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:


                 reply	other threads:[~2003-05-20 21:46 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=E19IEpf-0003cY-7y@tango.net.local \
    --to=doko@net.local \
    --cc=192135@bugs.debian.org \
    --cc=debian-gcc@lists.debian.org \
    --cc=gcc-gnats@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).