comp.lang.ada
 help / color / mirror / Atom feed
From: "(see below)" <yaldnif.w@blueyonder.co.uk>
Subject: Re: Bug in GNAT GPL 2006?
Date: Thu, 22 Feb 2007 06:09:44 +0000
Date: 2007-02-22T06:09:44+00:00	[thread overview]
Message-ID: <C202E428.988C8%yaldnif.w@blueyonder.co.uk> (raw)
In-Reply-To: 1172110443.971020.58150@v33g2000cwv.googlegroups.com

On 22/2/07 02:14, in article
1172110443.971020.58150@v33g2000cwv.googlegroups.com, "Adam Beneschan"
<adam@irvine.com> wrote:

> On Feb 21, 12:19 pm, "Randy Brukardt" <r...@rrsoftware.com> 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.

-- 
Bill Findlay
<surname><forename> chez blueyonder.co.uk





  reply	other threads:[~2007-02-22  6:09 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-02-21 19:47 Bug in GNAT GPL 2006? (see below)
2007-02-21 20:19 ` Randy Brukardt
2007-02-21 20:57   ` (see below)
2007-02-22  2:14   ` Adam Beneschan
2007-02-22  6:09     ` (see below) [this message]
2007-02-22  6:53       ` Per Sandberg
2007-02-22 10:52 ` Alex R. Mosteo
2007-02-22 16:39   ` (see below)
2007-02-23  1:37     ` Robert A Duff
2007-02-23  3:51       ` (see below)
2007-02-24 19:15         ` Robert A Duff
2007-02-24 20:52           ` Georg Bauhaus
2007-02-25  1:21           ` Jeffrey R. Carter
2007-02-23 14:04 ` The Ada 2005 name (was: Re: Bug in GNAT GPL 2006?) Dirk Craeynest
2007-02-24 10:47   ` The Ada 2005 name Stephen Leake
replies disabled

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