https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78845

            Bug ID: 78845
           Summary: Inverse (Real_Matrix) result has wrong bounds
           Product: gcc
           Version: 6.1.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: ada
          Assignee: unassigned at gcc dot gnu.org
          Reporter: simon at pushface dot org
  Target Milestone: ---
              Host: x86_64-apple-darwin15
            Target: x86_64-apple-darwin15
             Build: x86_64-apple-darwin15

Created attachment 40356
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=40356&action=edit
Reproducer

ARM G.3.1(72) for Inverse says

"... The index ranges of the result are A'Range(2) and A'Range(1). ..."

but with GCC’s code for Ada.Numerics.Real_Arrays.Inverse the second dimension’s
index range starts at 1, not A’First(1).

Demo:

with Ada.Numerics.Real_Arrays;
with Ada.Text_Io; use Ada.Text_Io;
procedure Inverse_Problem is
   A : Ada.Numerics.Real_Arrays.Real_Matrix (-10 .. -10, 12 .. 12)
     := (others => (others => -120.0));
   A_Inv : constant Ada.Numerics.Real_Arrays.Real_Matrix
     := Ada.Numerics.Real_Arrays.Inverse (A);
begin
   Put_Line ("1st index: " & Integer'Image (A_Inv'First (1))
               & " .. " & Integer'Image (A_Inv'Last (1)));
   Put_Line ("2nd index: " & Integer'Image (A_Inv'First (2))
               & " .. " & Integer'Image (A_Inv'Last (2)));
end Inverse_Problem;

Output:

$ ./inverse_problem 
1st index:  12 ..  12
2nd index:  1 ..  1

Reply via email to