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,start X-Google-Attributes: gida07f3367d7,public,usenet X-Google-NewGroupId: yes X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news2.google.com!news4.google.com!feeder.news-service.com!news2.euro.net!82.197.223.108.MISMATCH!feeder8.cambrium.nl!feed.tweaknews.nl!195.238.0.231.MISMATCH!news.skynet.be!195.238.0.222.MISMATCH!newsspl501.isp.belgacom.be!tjb!not-for-mail Date: Tue, 28 Apr 2009 19:04:52 +0200 From: Olivier Scalbert User-Agent: Thunderbird 2.0.0.21 (X11/20090318) MIME-Version: 1.0 Newsgroups: comp.lang.ada Subject: Problem with optimizations Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Message-ID: <49f73730$0$2850$ba620e4c@news.skynet.be> Organization: -= Belgacom Usenet Service =- NNTP-Posting-Host: dd40dffe.news.skynet.be X-Trace: 1240938288 news.skynet.be 2850 87.65.130.237:55156 X-Complaints-To: usenet-abuse@skynet.be Xref: g2news2.google.com comp.lang.ada:5578 Date: 2009-04-28T19:04:52+02:00 List-Id: Hello, I have write a little program that try to solve Rubik's cube, just to practice a little Ada. The program is really stupid (brute force) but I have a strange problem. When I compile it with: gnatmake -O2 rubukmain, it works: Depth: 1 Positions Counter: 12 Depth: 2 Positions Counter: 132 Depth: 3 Positions Counter: 1440 Depth: 4 Positions Counter: 15720 Depth: 5 Positions Counter: 171600 Depth: 6 Positions Counter: 1873200 Depth: 7 Positions Counter: 20448000 Depth: 8 Solved ! 1 12 8 10 2 6 3 3 Positions Counter: 18104705 When I compile it with: gnatmake -O3 rubukmain, it does not work: Depth: 1 Positions Counter: 1 Then it stops. 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. Thanks, Olivier