public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [Ada] Fix PR ada/78845
@ 2016-12-17 11:10 Simon Wright
  2016-12-20 12:14 ` Arnaud Charlet
  0 siblings, 1 reply; 6+ messages in thread
From: Simon Wright @ 2016-12-17 11:10 UTC (permalink / raw)
  To: gcc-patches

[-- Attachment #1: Type: text/plain, Size: 548 bytes --]

The function Ada.Numerics.Generic_Real_Arrays.Inverse is required (ARM G.3.1(72)) to return a matrix with the bounds of the dimension indices swapped, i.e. result'Range(1) == input'Range(2) and vice versa. The present code gets result'Range(1) correct, but result'Range(2) always starts at 1.

Of course, many users would always use ranges starting at 1 and wouldn't see a problem.

2016-12-17  Simon Wright  <simon@pushface.org>

	PR ada/78845
	* a-ngrear.adb (Inverse): call Unit_Matrix with First_1 set to A'First(2)
	and vice versa.


[-- Attachment #2: a-ngrear.adb.diff --]
[-- Type: application/octet-stream, Size: 446 bytes --]

--- a-ngrear.adb-orig	2012-03-07 14:45:51.000000000 +0000
+++ a-ngrear.adb	2016-12-17 09:15:02.000000000 +0000
@@ -498,7 +498,9 @@
    -------------
 
    function Inverse (A : Real_Matrix) return Real_Matrix is
-     (Solve (A, Unit_Matrix (Length (A))));
+     (Solve (A, Unit_Matrix (Length (A),
+                             First_1 => A'First (2),
+                             First_2 => A'First (1))));
 
    ------------
    -- Jacobi --

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2017-01-10 12:02 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-12-17 11:10 [Ada] Fix PR ada/78845 Simon Wright
2016-12-20 12:14 ` Arnaud Charlet
     [not found]   ` <B2185111-5A47-432A-B562-A65199236B25@pushface.org>
2016-12-21  8:52     ` Arnaud Charlet
     [not found]       ` <4D07E255-BDCD-47AC-A546-926E024E2425@pushface.org>
2016-12-21 15:03         ` Arnaud Charlet
2017-01-10 11:18           ` Simon Wright
2017-01-10 12:02             ` Arnaud Charlet

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).