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-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,13ab88b30e0f779d X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2002-12-28 09:25:52 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!newsfeed.icl.net!newsfeed.fjserv.net!colt.net!kibo.news.demon.net!demon!news-hub.cableinet.net!blueyonder!internal-news-hub.cableinet.net!news-binary.blueyonder.co.uk.POSTED!53ab2750!not-for-mail User-Agent: Microsoft-Entourage/10.1.1.2418 Subject: Re: Efficient Matrix? From: Bill Findlay Newsgroups: comp.lang.ada Message-ID: References: <3e0b2a66_4@news.bluewin.ch> Mime-version: 1.0 Content-Type: text/plain; charset="US-ASCII" Content-transfer-encoding: 7bit Date: Sat, 28 Dec 2002 17:25:38 +0000 NNTP-Posting-Host: 80.195.52.70 X-Complaints-To: abuse@blueyonder.co.uk X-Trace: news-binary.blueyonder.co.uk 1041096351 80.195.52.70 (Sat, 28 Dec 2002 17:25:51 GMT) NNTP-Posting-Date: Sat, 28 Dec 2002 17:25:51 GMT Organization: blueyonder (post doesn't reflect views of blueyonder) Xref: archiver1.google.com comp.lang.ada:32362 Date: 2002-12-28T17:25:38+00:00 List-Id: On 28/12/02 16:07, in article wccisxeqg8m.fsf@shell01.TheWorld.com, "Robert A Duff" wrote: > Bill Findlay writes: > >> I get good results as follows, with GNAT 5.00w for MacOS X. > ^^^^ > You misspelled "bad". ;-) > I meant it was good that the OP could get the array well packed. It is bad in every other sense. 8-) But I read 13.2 as normative, not binding: 13.2(6) says "should try" and 13.2(7) says "recommended". 13.3 is similarly worded w.r.t. Component_Size. > > That makes no sense. How can the 'Component_Size differ between > subtypes of the same type? And how can the compiler accept the "for > unconstrained_type'Component_Size use 1;", and then return > unconstrained_type'Component_Size use = 8? I agree that this has to be a bug. > I suspect that if you add: > > type Unconstrained_Type_Ptr is access Unconstrained_Type; > B: Unconstrained_Type_Ptr := new Unconstrained_Type(1..10_000, 1..5000); > > then B.all'Size will be 50_000_000, implying that Alas not (I reduced the array bounds by a factor of 10 to get a reasonable execution time): ---------------------------------------------------------------- procedure bla is type unconstrained_type is array (Positive range <>, Positive range <>) of Boolean; for unconstrained_type'Component_Size use 1; pragma Pack (unconstrained_type); type unconstrained_type_ptr is access unconstrained_type; subtype constrained_type is unconstrained_type (1 .. 1000, 1 .. 500); type constrained_type_ptr is access constrained_type; C : constrained_type_ptr := new constrained_type; U : unconstrained_type_ptr := new unconstrained_type (1 .. 1000, 1 .. 500); begin Put_Line (Integer'Image (constrained_type'Component_Size)); Put_Line (Integer'Image (unconstrained_type'Component_Size)); Put_Line (Integer'Image (constrained_type'Size)); Put_Line ("Cannot evaluate unconstrained_type'Size - would raise Constraint_Error"); Put_Line (Integer'Image (C.all'Size)); Put_Line (Integer'Image (U.all'Size)); for i in C'range(1) loop for j in C'range(2) loop C(i,j) := true; U(i,j) := false; end loop; end loop; U(500, 250) := true; C.all := U.all; Put_Line("C(500, 250..251) = " & Boolean'image(C(500, 250)) &","& Boolean'image(C(500, 251))); end bla; ---------------------------------------------------------------- % ./bla 1 8 500000 Cannot evaluate unconstrained_type'Size - would raise Constraint_Error 500000 4000000 C(500, 250..251) = TRUE,FALSE ---------------------------------------------------------------- Definitely something fishy here. If the components of C and U had different sizes then a lot of run-time packing would be needed to implement C.all := U.all; (and indeed the object code is enormous, but I don't know enough to say if that's what it's doing - it certainly shouldn't be). How can we tell whether the size attributes are lying? -- Bill-Findlay chez blue-yonder.co.uk ("-" => "")