Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Bug in GNAT GPL 2006?

2 views
Skip to first unread message

(see below)

unread,
Feb 21, 2007, 2:47:07 PM2/21/07
to
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?

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


Randy Brukardt

unread,
Feb 21, 2007, 3:19:52 PM2/21/07
to comp.l...@ada-france.org
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.

Randy.

(see below)

unread,
Feb 21, 2007, 3:57:21 PM2/21/07
to
On 21/2/07 20:19, in article
mailman.102.117208920...@ada-france.org, "Randy Brukardt"
<ra...@rrsoftware.com> wrote:

>> return result : Boolean do
>> |
>>>>> warning: variable "result" is assigned but never read

>> 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.

Thanks, Randy.

Adam Beneschan

unread,
Feb 21, 2007, 9:14:04 PM2/21/07
to

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.

-- Adam


(see below)

unread,
Feb 22, 2007, 1:09:44 AM2/22/07
to
On 22/2/07 02:14, in article
1172110443....@v33g2000cwv.googlegroups.com, "Adam Beneschan"
<ad...@irvine.com> wrote:

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.

Per Sandberg

unread,
Feb 22, 2007, 1:53:18 AM2/22/07
to
Well it is fixed in the latest version (GNATPro 6.0.1).
/Per

Alex R. Mosteo

unread,
Feb 22, 2007, 5:52:35 AM2/22/07
to
(see below) wrote:

> 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?

It was my impression that extended return wasn't completely finished. Did you
get that to work, despite the warning?

(see below)

unread,
Feb 22, 2007, 11:39:52 AM2/22/07
to
On 22/2/07 10:52, in article 545av3F...@mid.individual.net, "Alex R.
Mosteo" <dev...@mailinator.com> wrote:

Looks like it. Trouble is, I can't find anything on the Libre
site that defines what is or is not finished in GNAT GPL. 8-(

> Did you get that to work, despite the warning?

Yes, that runs properly as far as I have tested it.

This bug:

>> 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.

is interesting - if I interpret the error message correctly,
the compiler is trying (in effect) to textually nest the extended
return of the subsidiary function inside the caller's extended return
and then complaining that the product of doing that is illegal
(as I would hope it is).

It compiles correctly (modulo further testing) if inlining is switched off.

Robert A Duff

unread,
Feb 22, 2007, 8:37:37 PM2/22/07
to
"(see below)" <yald...@blueyonder.co.uk> writes:

If you report this inlining bug to AdaCore, it will eventually get
fixed. In fact, I've been working on this extended-return stuff lately,
so I am indeed interested in seeing bug reports related to that.

By the way, I think the bogus warning mentioned above is fixed in the
latest GNAT sources. And as far as I know, the generated code is
correct even in the presence of that warning.

- Bob

(see below)

unread,
Feb 22, 2007, 10:51:05 PM2/22/07
to
On 23/2/07 01:37, in article wccwt29...@shell01.TheWorld.com, "Robert A
Duff" <bob...@shell01.TheWorld.com> wrote:

> If you report this inlining bug to AdaCore, it will eventually get
> fixed. In fact, I've been working on this extended-return stuff lately,
> so I am indeed interested in seeing bug reports related to that.
>
> By the way, I think the bogus warning mentioned above is fixed in the
> latest GNAT sources. And as far as I know, the generated code is
> correct even in the presence of that warning.

Bob,
can you say what is the correct mechanism for reporting bugs in GNAT GPL?

Dirk Craeynest

unread,
Feb 23, 2007, 9:04:02 AM2/23/07
to
Bill Findlay wrote:
>can anyone more knowledgeable about Ada 200[57] confirm this?

I notice that once in a while there appears to be some confusion
about how to refer to the latest Ada language definition.

FYI, the internationally accepted recommendation is to use the name
"Ada 2005".

Obviously the official name of the language is Ada, but when referring
to previous "instances" of the standard, the Ada community has been
using Ada 83 and Ada 95 as informal or "vernacular" names.

In an attempt to avoid possible confusion about how to refer to the
amended Ada language definition, the ISO working group on Ada (WG9)
discussed this issue during its June 2005 meeting in York. Various
proposals were made and many arguments were presented. For those of
you who are interested: a summary of the discussion is available in
the minutes of that meeting [1].

Finally, the following recommendation was accepted *unanimously*:

``Recognizing that ISO's publication date will differ from the
date of technical completion in 2005, and recognizing that the
term "Ada 2005" is widely used in the community, WG9 recommends
that an appropriate vernacular designation for the amended
language should be "Ada 2005".'' [2]

That's why in most literature, marketing material, communications, etc,
we refer to the amended language as "Ada 2005".

This includes e.g. the ARA announcement "Ada 2005 on Track for Formal
ISO Approval" [3], Ada-Europe's press release "Technical Work on Ada
2005 Standard Completed" [4], and the title "Ada 2005 Reference Manual.
Language and Standard Libraries" of the book recently published by
Springer in its LNCS (Lecture Notes in Computer Science) series [5].

[1] <http://www.open-std.org/jtc1/sc22/wg9/n451.htm#VernName>
[2] <http://www.open-std.org/jtc1/sc22/wg9/n451.htm#r5>
[3] <http://www.adaic.com/news/iso-Ada05.html>
[4] <http://www.ada-europe.org/Ada_2005_Press_Release.pdf>
[5] <http://www.springer.com/home?SGWID=5-102-22-173712407-0>

We may all have our personal preferences about how to name things,
but in the interest of global understandability and to avoid creating
confusion, may I suggest we all abide to that recommendation of the
ISO working group on Ada?

So, when referring to the language in general, use "Ada", and when
referring to the recently amended language definition in particular,
use "Ada 2005".

I hope this helps.

Dirk Craeynest
Dirk.Cr...@cs.kuleuven.be
ISO/IEC JTC1/SC22/WG9, Head of Delegation, Belgium

Stephen Leake

unread,
Feb 24, 2007, 5:47:48 AM2/24/07
to
di...@cs.kuleuven.ac.be (Dirk Craeynest) writes:

> I notice that once in a while there appears to be some confusion
> about how to refer to the latest Ada language definition.
>
> FYI, the internationally accepted recommendation is to use the name
> "Ada 2005".

Thank you!

--
-- Stephe

Robert A Duff

unread,
Feb 24, 2007, 2:15:12 PM2/24/07
to
"(see below)" <yald...@blueyonder.co.uk> writes:

> can you say what is the correct mechanism for reporting bugs in GNAT GPL?

I think there's some info about that in the distribution.
A README file or some such. Sorry, I don't remember the details.

- Bob

Georg Bauhaus

unread,
Feb 24, 2007, 3:52:47 PM2/24/07
to

The only way to know from the "binary" distribution
is, I think, to trigger a bug box. :-)


Jeffrey R. Carter

unread,
Feb 24, 2007, 8:21:02 PM2/24/07
to

rep...@gnat.com; include "GNAT Bug" in the subject.

--
Jeff Carter
"Beyond 100,000 lines of code you
should probably be coding in Ada."
P. J. Plauger
26

0 new messages