comp.lang.ada
 help / color / mirror / Atom feed
From: Bill Findlay <yaldnif.w@blueyonder.co.uk>
Subject: Re: expression function bug or think?
Date: Fri, 17 Jun 2011 00:14:29 +0100
Date: 2011-06-17T00:14:29+01:00	[thread overview]
Message-ID: <CA204CE5.C27D%yaldnif.w@blueyonder.co.uk> (raw)
In-Reply-To: m2tybp1pce.fsf@pushface.org

On 16/06/2011 21:41, in article m2tybp1pce.fsf@pushface.org, "Simon Wright"
<simon@pushface.org> wrote:

> GNAT GPL 2011, without -gnatp:
> 
> functions_E : short_integer := 0;
> 
> package functions is
>    function functions__fib (n : natural) return natural;
> 
>    function functions__fib (n : natural) return natural is
>    begin
>       return
>          do
>             T2s : natural;[constraint_error when
>               not (n - 1 >= 0)
>               "range check failed"][constraint_error when
>               not (n - 2 >= 0)
>               "range check failed"][constraint_error when
>               not (interfaces__unsigned_32!(n) <= 16#7FFF_FFFF#)
>               "invalid data"]
>             case n is
>                when 0 =>
>                   T2s := 0;
>                when 1 =>
>                   T2s := 1;
>                when others =>
>                   T2s := functions__fib (n - 1) + functions__fib (n -
>                     2);
>             end case;
>          in T2s end
>       ;
>    end functions__fib;
> end functions;
> 
> 
> 
> Pretty conclusive, I think!

So it would seem, but without -gnatp I get exactly the same result as you do
with -gnatp:

> /Users/wf: gnatmake  -gnat12 -gnatl -gnatG run_fib.adb >nop.txt
> gcc -c -gnat12 -gnatl -gnatG run_fib.adb
> gcc -c -gnat12 -gnatl -gnatG functions.ads
> gnatbind -x run_fib.ali
> gnatlink run_fib.ali
> 
> /Users/wf: cat nop.txt
> 
> GNAT GPL 2011 (20110419)
> Copyright 1992-2011, Free Software Foundation, Inc.
> Source recreated from tree for Run_Fib (body)
> ---------------------------------------------
> 
> ....
> 
> GNAT GPL 2011 (20110419)
> Copyright 1992-2011, Free Software Foundation, Inc.
> Source recreated from tree for Functions (spec)
> -----------------------------------------------
> 
> functions_E : short_integer := 0;
> 
> package functions is
>    function functions__fib (n : natural) return natural;
> 
>    function functions__fib (n : natural) return natural is
>    begin
>       return
>          do
>             T2s : natural;
>             case n is
>                when 0 =>
>                   T2s := 0;
>                when 1 =>
>                   T2s := 1;
>                when others =>
>                   T2s := functions__fib (n - 1) + functions__fib (n -
>                     2);
>             end case;
>          in T2s end
>       ;
>    end functions__fib;
> end functions;
> 

?

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





  parent reply	other threads:[~2011-06-16 23:14 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
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 [this message]
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