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,11c630572e59f461 X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news2.google.com!news3.google.com!news.glorb.com!tudelft.nl!txtfeed1.tudelft.nl!feed.xsnews.nl!border-1.ams.xsnews.nl!68.142.88.75.MISMATCH!hwmnpeer01.ams!news.highwinds-media.com!hw-filter.ams!newsfe27.ams.POSTED!40385e62!not-for-mail From: Per Sandberg User-Agent: Thunderbird 1.5.0.9 (Windows/20061207) MIME-Version: 1.0 Newsgroups: comp.lang.ada Subject: Re: Bug in GNAT GPL 2006? References: <1172110443.971020.58150@v33g2000cwv.googlegroups.com> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Message-ID: X-Complaints-To: abuse@WWWSpace.NET NNTP-Posting-Date: Wed, 21 Feb 2007 23:48:48 MST Date: Thu, 22 Feb 2007 07:53:18 +0100 Xref: g2news2.google.com comp.lang.ada:9397 Date: 2007-02-22T07:53:18+01:00 List-Id: Well it is fixed in the latest version (GNATPro 6.0.1). /Per (see below) wrote: > On 22/2/07 02:14, in article > 1172110443.971020.58150@v33g2000cwv.googlegroups.com, "Adam Beneschan" > wrote: > >> On Feb 21, 12:19 pm, "Randy Brukardt" wrote: >>> Bill Findlay writes: >>>> Using GNAT GPL 2006 (20060522-34) I get warning messages >>>> like the following when using extended return statements: >>>> function is_empty (the_table : a_safe_table) return Boolean is >>>> begin >>>> return result : Boolean do >>>> | >>>>>>> warning: variable "result" is assigned but never read >>>> lock_table; >>>> result := is_empty(a_basic_table(the_table)); >>>> unlock_table; >>>> end return; >>>> end is_empty; >>>> I'm inclined to assume that this is a compiler bug, but can >>>> anyone more knowledgeable about Ada 200[57] confirm this? >>> Sure looks like a (harmless) compiler bug to me. It's hard to imagine why >>> you would be required to read the result of a function before returning it. >> Looks to me like the compiler is (incorrectly) pretending it's a >> normal variable. If you had declared "result : Boolean" before the >> "begin", and then assigned it but never used it, I can imagine the >> compiler being suspicious that something was perhaps mistyped >> somewhere, and displaying a warning. Just a very understandable >> implementation bug. > > Yes, I think so. > Extraordinarily, the example given in the Ada 2005 RM has this property. > > Unfortunately, it is not the only extended return bug in GNAT GPL 2006. > > Obtaining the value of a defining identifier from a call to another > (inlined) function having itself an extended return also fails to compile; > giving a nonsensical message at the point of call of the latter. >