From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: a07f3367d7,d275ad890e7b3ecc X-Google-Attributes: gida07f3367d7,public,usenet X-Google-NewGroupId: yes X-Google-Language: ENGLISH,ASCII-7-bit Received: by 10.180.94.98 with SMTP id db2mr98617wib.2.1348190018645; Thu, 20 Sep 2012 18:13:38 -0700 (PDT) Path: q11ni3492521wiw.1!nntp.google.com!feeder1.cambriumusenet.nl!feed.tweaknews.nl!85.12.40.131.MISMATCH!xlned.com!feeder3.xlned.com!news.astraweb.com!border6.a.newsrouter.astraweb.com!border4.nntp.ams.giganews.com!border2.nntp.ams.giganews.com!border3.nntp.ams.giganews.com!border1.nntp.ams.giganews.com!nntp.giganews.com!newsreader4.netcologne.de!news.netcologne.de!goblin2!goblin.stu.neva.ru!aioe.org!eternal-september.org!feeder.eternal-september.org!mx04.eternal-september.org!.POSTED!not-for-mail From: Simon Wright Newsgroups: comp.lang.ada Subject: Re: problem with Real_Matrix*Real_Matrix Date: Tue, 18 Sep 2012 11:50:33 +0100 Organization: A noiseless patient Spider Message-ID: References: <31325794-475b-430c-a419-a96da29251f0@googlegroups.com> Mime-Version: 1.0 Injection-Info: mx04.eternal-september.org; posting-host="a9272c9c584810f74e3f95ce46cbeceb"; logging-data="4662"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/ZbmPBDhcgMcwi69fI1y6vGiZuBTGFncU=" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.2 (darwin) Cancel-Lock: sha1:Z/7HT2Oiuri7fPIgVCBFkEZX1Go= sha1:9rVzs6eFifvHIEcONicI3RVqOFY= Content-Type: text/plain Date: 2012-09-18T11:50:33+01:00 List-Id: Anatoly Chernyshev writes: > Got the same mistake on Win7/GNAT 2012. As I'm doing matrix > calculations too, I had to investigate, and here's the culprit from > s-gearop.adb: > --------------------------------------------------------------- > function Vector_Matrix_Product (Left : Left_Vector; Right : Matrix) > return Result_Vector is begin return R : Result_Vector (Right'Range > (2)) do if Left'Length /= Right'Length (2) then raise Constraint_Error > with "incompatible dimensions in vector-matrix multiplication"; end > if; > > for J in Right'Range (2) loop > declare > S : Result_Scalar := Zero; > > begin > for K in Right'Range (1) loop > S := S + Left (J - Right'First (1) > + Left'First) * Right (K, J); > end loop; > > R (J) := S; end; end loop; end return; end > Vector_Matrix_Product; > --------------------------------------------------------------- > S := S + Left (J - Right'First (1) + Left'First) * Right (K, J); - in > this fragment Left is kept constant within the K-cycle. Replacing > Left'First with K would correct the problem. > > I believe, it was straightened for some reason for the Mac > distribution; would be interesting to compare. You're right about the location of the problem, but I think the fix is instead to change S := S + Left (J - Right'First (1) to S := S + Left (K - Right'First (1) I've filed a bug in the GCC Bugzilla against GCC 4.7.0: http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54614