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=-0.3 required=5.0 tests=BAYES_00, REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!news.eternal-september.org!mx02.eternal-september.org!.POSTED!not-for-mail From: Georg Bauhaus Newsgroups: comp.lang.ada Subject: Re: Is this a bug in my code or the compiler? Date: Sat, 13 Jun 2015 12:04:57 +0200 Organization: A noiseless patient Spider Message-ID: References: <4f4cd4b1-0a6d-441b-a4f7-98add70e4e1e@googlegroups.com> <1p71vf5ckbudu$.1qcb9ot1jpysk.dlg@40tude.net> <1g33axhwakrzx.o6t14iz4jruy.dlg@40tude.net> Reply-To: nonlegitur@futureapps.de Mime-Version: 1.0 Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit Injection-Date: Sat, 13 Jun 2015 10:03:36 +0000 (UTC) Injection-Info: mx02.eternal-september.org; posting-host="b96887e80893c84a90c3007226ca0d1c"; logging-data="18265"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+kEv7rVvZ5YtH6C+rVYVAzkM2iCtncf9Y=" User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.9; rv:31.0) Gecko/20100101 Thunderbird/31.7.0 In-Reply-To: <1g33axhwakrzx.o6t14iz4jruy.dlg@40tude.net> Cancel-Lock: sha1:RmeXOP12vLyEpMzxYbauOEl8aWk= Xref: news.eternal-september.org comp.lang.ada:26300 Date: 2015-06-13T12:04:57+02:00 List-Id: On 12.06.15 20:00, Dmitry A. Kazakov wrote: > On Fri, 12 Jun 2015 19:25:00 +0200, G.B. wrote: > >> On 12.06.15 18:15, Dmitry A. Kazakov wrote: >>> Foo (A) and Foo (A) -- Illegal >>> Foo (A) and then Foo (A) -- Legal >> >> C has similar features... > > So? > >>> P.P.S. It would become even worse with fine-grained parallelism, as Georg >>> keep on suggesting. >> >> Not sure to what this is referring > > Parallel evaluation of arguments. Yes, but where is the difference, exactly, between incorrect due to order dependence, and incorrect due to sharing issues? If nothing is lost by forcing an order on evaluation of arguments on all programs, then I don't know any more why that's not enforced by languages, and why instead we saw Haskell. >> So, in Ada 83, when A is of an access type, > > That does not change anything because: > >> Foo (A) and Foo (A) -- Legal > > Only if A is a constant access. Illegal otherwise. Is there chapter and verse in the 83 LRM for this? I found this in 1.6: "Whenever the reference manual specifies that different parts of a given construct are to be executed in some order that is not defined by the language, this means that the implementation is allowed to execute these parts in any given order, following the rules that result from that given order, but not in parallel. Furthermore, the construct is incorrect if execution of these parts in a different order would have a different effect. Compilers are not required to provide either compilation-time or run-time detection of incorrect order dependences." (No mention of legality here.) So, is GNAT buggy if it accepts this Ada 83 program (you claim that it is *easy* to detect aliasing of A and B): WITH Text_IO; PROCEDURE Par IS TYPE I IS RANGE 1 .. 3; TYPE Ptr IS ACCESS I; A, B: Ptr; V, Legal : Boolean; FUNCTION Foo (X : Ptr) RETURN Boolean IS SEPARATE; PACKAGE Boolean_Io IS NEW Text_IO.Enumeration_IO (Boolean); BEGIN A := NEW I'(1); Boolean_Io.Get (V); IF V THEN B := A; ELSE B := NEW I'(3); END IF; Legal := Foo (A) AND Foo (B); -- legal? END Par; > parallelism is a can of worms. ... if designed without regard to parallel evaluation/execution. That's a matter of course, isn't it?