comp.lang.ada
 help / color / mirror / Atom feed
From: "(see below)" <yaldnif.w@blueyonder.co.uk>
Subject: Re: Problem with optimizations
Date: Tue, 28 Apr 2009 19:40:07 +0100
Date: 2009-04-28T19:40:07+01:00	[thread overview]
Message-ID: <C61D0C17.115054%yaldnif.w@blueyonder.co.uk> (raw)
In-Reply-To: 49f73730$0$2850$ba620e4c@news.skynet.be

On 28/04/2009 18:04, in article 49f73730$0$2850$ba620e4c@news.skynet.be,
"Olivier Scalbert" <olivier.scalbert@algosyn.com> 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, <surname><forename> 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




  parent reply	other threads:[~2009-04-28 18:40 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-04-28 17:04 Problem with optimizations Olivier Scalbert
2009-04-28 17:34 ` Albrecht Käfer
2009-04-28 17:54   ` Olivier Scalbert
2009-04-28 18:32     ` Albrecht Käfer
2009-04-28 19:15     ` John B. Matthews
2009-04-28 18:40 ` (see below) [this message]
2009-04-28 19:05   ` Albrecht Käfer
2009-04-28 19:15     ` Olivier Scalbert
2009-04-28 19:17       ` Olivier Scalbert
2009-04-28 19:26         ` Gautier
2009-04-28 21:33       ` sjw
2009-04-29 10:36       ` johnscpg
2009-04-29 10:45       ` johnscpg
2009-04-29 13:51       ` johnscpg
2009-04-28 19:06   ` Olivier Scalbert
2009-04-28 19:12     ` (see below)
2009-04-29  2:35       ` Gene
2009-04-29  3:28         ` (see below)
2009-04-29  7:05           ` Georg Bauhaus
2009-04-28 19:46 ` Gautier
2009-04-28 20:05   ` Olivier Scalbert
2009-04-28 20:21   ` Olivier Scalbert
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox