comp.lang.ada
 help / color / mirror / Atom feed
From: Bill Findlay <yaldnif.w@blueyonder.co.uk>
Subject: Re: expression function bug or think?
Date: Thu, 16 Jun 2011 19:56:31 +0100
Date: 2011-06-16T19:56:31+01:00	[thread overview]
Message-ID: <CA20106F.C247%yaldnif.w@blueyonder.co.uk> (raw)
In-Reply-To: 678085105329914667.504682rmhost.bauhaus-maps.arcor.de@news.arcor.de

On 16/06/2011 12:00, in article
678085105329914667.504682rmhost.bauhaus-maps.arcor.de@news.arcor.de, "georg
bauhaus" <rmhost.bauhaus@maps.arcor.de> wrote:

> When I compile the following program with GNAT GPL 2011 on Mac,
> I get confusingly different behavior depending on whether
> or not I suppress checks.

Strange. On Snow Leopard 10.6.7, I compile and run:

> /Users/wf/: gnatmake -gnat12 -gnatl run_fib.adb
> gcc -c -gnat12 -gnatl run_fib.adb
> 
> GNAT GPL 2011 (20110419)
> Copyright 1992-2011, Free Software Foundation, Inc.
> 
> 
> Compiling: run_fib.adb (source file time stamp: 2011-06-16 18:50:24)
> 
>      1. with Functions;
>      2. with Ada.Text_IO;
>      3.
>      4. procedure Run_Fib is
>      5.     N : Natural;
>      6. begin
>      7.     if Functions.Fib(0) /= 0 then
>      8.          raise Program_Error;
>      9.     end if;
>     10.     N := Functions.Fib(10);
>     11.     Ada.Text_IO.Put_Line ("fib(10) =" & Natural'Image(N));
>     12. end Run_Fib;
> 
>  12 lines: No errors
> gcc -c -gnat12 -gnatl functions.ads
> 
> GNAT GPL 2011 (20110419)
> Copyright 1992-2011, Free Software Foundation, Inc.
> 
> 
> Compiling: functions.ads (source file time stamp: 2011-06-16 18:51:28)
> 
>      1. package Functions is
>      2.    function Fib (N : Natural) return Natural is
>      3.        (case N is
>      4.         when 0 => 0,
>      5.         when 1 => 1,
>      6.         when others => Fib(N-1) + Fib(N-2));  -- L.6
>      7. end Functions;
> 
>  7 lines: No errors
> gnatbind -x run_fib.ali
> gnatlink run_fib.ali
> 
> 
> /Users/wf/: ./run_fib
> fib(10) = 55

The -gnatp option makes no difference.


-- 
Bill Findlay
with blueyonder.co.uk;
use  surname & forename;





  parent reply	other threads:[~2011-06-16 18:56 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-06-16 11:00 expression function bug or think? georg bauhaus
2011-06-16 11:27 ` AdaMagica
2011-06-16 15:56 ` Adam Beneschan
2011-06-17  3:56   ` Yannick Duchêne (Hibou57)
2011-06-16 16:16 ` Anh Vo
2011-06-16 18:56 ` Bill Findlay [this message]
2011-06-16 19:18   ` Simon Wright
2011-06-16 20:03     ` Georg Bauhaus
2011-06-16 20:03     ` Bill Findlay
2011-06-16 20:31 ` Florian Weimer
2011-06-16 20:41   ` Simon Wright
2011-06-16 21:14     ` Georg Bauhaus
2011-06-16 23:14     ` Bill Findlay
2011-06-17  9:34     ` Martin
2011-06-17 10:33       ` Simon Wright
2011-06-17 10:39         ` Martin
2011-06-17 11:09           ` Niklas Holsti
2011-06-16 21:04   ` Georg Bauhaus
2011-06-17  8:55   ` Georg Bauhaus
2011-06-17  9:10     ` Georg Bauhaus
replies disabled

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