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: 103376,ed872c72866dab2b X-Google-NewGroupId: yes X-Google-Attributes: gida07f3367d7,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news2.google.com!news2.google.com!npeer01.iad.highwinds-media.com!news.highwinds-media.com!feed-me.highwinds-media.com!postnews.google.com!news4.google.com!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail From: Bill Findlay Newsgroups: comp.lang.ada Subject: Re: expression function bug or think? Date: Fri, 17 Jun 2011 00:14:29 +0100 Message-ID: References: <678085105329914667.504682rmhost.bauhaus-maps.arcor.de@news.arcor.de> <87wrglwmao.fsf@mid.deneb.enyo.de> Mime-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit X-Trace: individual.net H1HBZnBmXSRaYSdDizqYyw+NjU8Nff29wkbCvxm9IqT5exEuTH Cancel-Lock: sha1:A7h+LT/TMQrnmjR1LGxtsvRjZ4g= User-Agent: Microsoft-Entourage/12.28.0.101117 Thread-Topic: expression function bug or think? Thread-Index: AcwseyRj4RmQLMxORk2exvp+2O9XdQ== Xref: g2news2.google.com comp.lang.ada:20865 Date: 2011-06-17T00:14:29+01:00 List-Id: On 16/06/2011 21:41, in article m2tybp1pce.fsf@pushface.org, "Simon Wright" 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;