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,3737542e2ed2b8e1 X-Google-Attributes: gida07f3367d7,public,usenet X-Google-NewGroupId: yes X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news2.google.com!news4.google.com!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail From: "(see below)" Newsgroups: comp.lang.ada Subject: Re: Problem with optimizations Date: Tue, 28 Apr 2009 19:40:07 +0100 Message-ID: References: <49f73730$0$2850$ba620e4c@news.skynet.be> Mime-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit X-Trace: individual.net dIW9sEp3u6pACuHW0kyjbg0Zeq+PWGjNXq+W49LIseGDd1q7Bw Cancel-Lock: sha1:PZxkIMixPIYtIn+sBJLFCB5en8g= User-Agent: Microsoft-Entourage/12.15.0.081119 Thread-Topic: Problem with optimizations Thread-Index: AcnIMMB6VC7oeUqF3UWTKDC3uQ4ryg== Xref: g2news2.google.com comp.lang.ada:5585 Date: 2009-04-28T19:40:07+01:00 List-Id: On 28/04/2009 18:04, in article 49f73730$0$2850$ba620e4c@news.skynet.be, "Olivier Scalbert" wrote: ... > When, inside the Recursive_Find_Solution, I replace Is_Solved by > Is_Solved1, then it works in all cases. > > I have try to understand what is happen with gdb and by having a look > into the generated code, but without success. > > I have the same behaviour with: > - Ubuntu 8.10 32 bits (GNATMAKE 4.3.2) > - Debian testing AMD 64bits (GNATMAKE 4.3.3) > > The code can be found there: > http://scalbert.dyndns.org/adarubik/ > > This small project is a really a toy but I would like to understand the > problem. There is no else part for the following if: if Is_Solved(Cube) then New_Line; Put("Solved !"); New_Line; for i in 1..depth-1 loop Ada.Integer_Text_IO.Put(Integer(Moves(i))); end loop; Result := True; end if; So the procedure can exit with Result undefined. Since the program is incorrect, varying optimisation, or implementation details, is likely to give varying results. Some may co-incidentally be the results you expect. P.S. I did not use gdb. -- Bill Findlay, chez blueyonder.co.uk "My own view on religion is that of Lucretius. I regard it as a disease born of fear and as a source of untold misery to the human race." B. Russell