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: g2news1.google.com!news3.google.com!feeder3.cambriumusenet.nl!feed.tweaknews.nl!193.201.147.68.MISMATCH!feeder.news-service.com!94.75.214.39.MISMATCH!aioe.org!eternal-september.org!feeder.eternal-september.org!.POSTED!not-for-mail From: Simon Wright Newsgroups: comp.lang.ada Subject: Re: expression function bug or think? Date: Thu, 16 Jun 2011 21:41:21 +0100 Organization: A noiseless patient Spider 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 Injection-Info: mx04.eternal-september.org; posting-host="dFCm8HWntFqmDIilBLqEJQ"; logging-data="22309"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18jCPdesdMj2P0yrgluAAa43GIaIGPxUTg=" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.3 (darwin) Cancel-Lock: sha1:zvl2qgN6bYZgYFX6AxOHdcanuWQ= sha1:fH2Zudz4XdQVMFUFCgOxi9wt4h4= Xref: g2news1.google.com comp.lang.ada:19891 Date: 2011-06-16T21:41:21+01:00 List-Id: Florian Weimer writes: > Out of curiosity, can you show us the expanded Ada code, using -gnatG? GNAT GPL 2011, with -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; 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; 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!