comp.lang.ada
 help / color / mirror / Atom feed
* GNAT bug?
@ 1998-02-27  0:00 Haug Buerger
  1998-02-28  0:00 ` Jerry van Dijk
  0 siblings, 1 reply; 16+ messages in thread
From: Haug Buerger @ 1998-02-27  0:00 UTC (permalink / raw)



Hi,

i need some help to find out if my program has a fault
or i'm to dump.

I have a generic package with a unconstrained array and
a pointer to it. I can allocate memory with new type(0..x).
If i try to access pointer.all(0) i get a constraint error.

What makes me wonder is that i can allocate with
new type(-1..x) without warning, the array is of "natural
range <>".

The second thing that makes me wonder is that the code
works outside of the generic. I get a warning there if
i try -1..x.

If somebody is willing to compile this very short code with
another compiler and tell me the result i can clear this
point and make a senseful bugreport if necessary.

Haug

For email use haug@zesi.ruhr.de !







^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: GNAT bug?
  1998-02-27  0:00 Haug Buerger
@ 1998-02-28  0:00 ` Jerry van Dijk
  0 siblings, 0 replies; 16+ messages in thread
From: Jerry van Dijk @ 1998-02-28  0:00 UTC (permalink / raw)



Haug Buerger <haug@localhost.ruhr.de> schreef in artikel
<c1.01.2KWhlX$01O@zesi.ruhr.de>...
> If somebody is willing to compile this very short code

which code ?

-- 
-- Jerry van Dijk | Leiden, Holland
-- Team Ada       | email: jdijk@acm.org





^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: GNAT bug?
  1999-02-09  0:00 Juergen.Hoyng
@ 1999-02-09  0:00 ` Stephen Leake
  1999-02-10  0:00   ` Pascal Obry
  1999-02-11  0:00   ` Juergen.Hoyng
  1999-02-10  0:00 ` Pascal Obry
  1 sibling, 2 replies; 16+ messages in thread
From: Stephen Leake @ 1999-02-09  0:00 UTC (permalink / raw)


Juergen.Hoyng@ri.dasa.de writes:

> Hello!
> 
> The followings compilation units can be compiled with the Ada83 compiler VADS
> 6.2.3(c) (Solaris 2.5.1) and Alsys 5.5.4 (HP_UX 10.20).
> 
<snip>

The program compiles without error in ObjectAda; submit a GNAT bug report.

-- Stephe




^ permalink raw reply	[flat|nested] 16+ messages in thread

* GNAT bug?
@ 1999-02-09  0:00 Juergen.Hoyng
  1999-02-09  0:00 ` Stephen Leake
  1999-02-10  0:00 ` Pascal Obry
  0 siblings, 2 replies; 16+ messages in thread
From: Juergen.Hoyng @ 1999-02-09  0:00 UTC (permalink / raw)


Hello!

The followings compilation units can be compiled with the Ada83 compiler VADS
6.2.3(c) (Solaris 2.5.1) and Alsys 5.5.4 (HP_UX 10.20).

generic
    type Item      is private;
package Foo is
    type Foo_Type (Kind: Positive) is limited private;
    procedure Foo_Op (Target : in out Foo_Type;
                      Source : in      Foo_Type);
private
   type Foo_Type (Kind: Positive) is
   record
     Blah_Bah : Integer;
    end record;
end Foo;

with Foo;
package X is
   package My_Foo is new Foo(Integer);
   type My_Foo_Type is new My_Foo.Foo_Type;
   procedure Test (X : in out My_Foo_Type;
                   Y : in     My_Foo_Type);
end X;

with Foo;
package body X is
   procedure Test (X : in out My_Foo_Type;
                   Y : in     My_Foo_Type) is
   begin
      Foo_Op (X,Y);  --    <-------- ?????
   end Test;
end X;

When trying to compile these compilation units with gnat-3.11p (Solaris 2.5.1)
I got the error message:
x.adb:6:15: expected private type "My_Foo_Type" defined at x.ads:4
x.adb:6:15: found type "My_Foo_Type" defined at x.ads:4

Is this an Ada95/Ada83 incompatibility or a GNAT bug?


Thanks in advance


Juergen



Juergen Hoyng,  RIO 62             |   email : Juergen.Hoyng@ri.dasa.de
DaimlerChrysler Aerospace AG	   |   fax   : +49 421 539 4529
Raumfahrt Infrastruktur            |
Postfach 286156                    |   voice : +49 421 539 5348
D-28361 Bremen                     |
Germany

-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/       Search, Read, Discuss, or Start Your Own    




^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: GNAT bug?
  1999-02-09  0:00 Juergen.Hoyng
  1999-02-09  0:00 ` Stephen Leake
@ 1999-02-10  0:00 ` Pascal Obry
  1999-02-10  0:00   ` Tucker Taft
  1 sibling, 1 reply; 16+ messages in thread
From: Pascal Obry @ 1999-02-10  0:00 UTC (permalink / raw)


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 877 bytes --]


Juergen.Hoyng@ri.dasa.de a �crit dans le message
<79ptl3$jdp$1@nnrp1.dejanews.com>...
>Hello!
>
>The followings compilation units can be compiled with the Ada83 compiler
VADS
>6.2.3(c) (Solaris 2.5.1) and Alsys 5.5.4 (HP_UX 10.20).
>

[code removed]

>
>When trying to compile these compilation units with gnat-3.11p (Solaris
2.5.1)
>I got the error message:
>x.adb:6:15: expected private type "My_Foo_Type" defined at x.ads:4
>x.adb:6:15: found type "My_Foo_Type" defined at x.ads:4
>
>Is this an Ada95/Ada83 incompatibility or a GNAT bug?
>

Your program is wrong :

Firstly Foo_Op is not visible. The X is defined as a new type so you must
do a type convertion. The offending line should read :

    My_Foo.Foo_Op (My_Foo.Foo_Type (X), My_Foo.Foo_Type (Y));

You can avoid the type convertion by using subtype instead of type for
My_Foo_Type
in package X.

Pascal.







^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: GNAT bug?
  1999-02-09  0:00 ` Stephen Leake
@ 1999-02-10  0:00   ` Pascal Obry
  1999-02-10  0:00     ` Tucker Taft
  1999-02-11  0:00   ` Juergen.Hoyng
  1 sibling, 1 reply; 16+ messages in thread
From: Pascal Obry @ 1999-02-10  0:00 UTC (permalink / raw)


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 404 bytes --]


Stephen Leake a �crit dans le message ...
>Juergen.Hoyng@ri.dasa.de writes:
>
>> Hello!
>>
>> The followings compilation units can be compiled with the Ada83 compiler
VADS
>> 6.2.3(c) (Solaris 2.5.1) and Alsys 5.5.4 (HP_UX 10.20).
>>
><snip>
>
>The program compiles without error in ObjectAda; submit a GNAT bug report.

So you should report an ObjectAda bug (see my previous message).

Pascal.







^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: GNAT bug?
  1999-02-10  0:00   ` Pascal Obry
@ 1999-02-10  0:00     ` Tucker Taft
  0 siblings, 0 replies; 16+ messages in thread
From: Tucker Taft @ 1999-02-10  0:00 UTC (permalink / raw)


Pascal Obry wrote:
> 
> Stephen Leake a �crit dans le message ...
> >Juergen.Hoyng@ri.dasa.de writes:
> >
> >> Hello!
> >>
> >> The followings compilation units can be compiled with the Ada83 compiler
> VADS
> >> 6.2.3(c) (Solaris 2.5.1) and Alsys 5.5.4 (HP_UX 10.20).
> >>
> ><snip>
> >
> >The program compiles without error in ObjectAda; submit a GNAT bug report.
> 
> So you should report an ObjectAda bug (see my previous message).

I don't agree.  The program makes correct use of derived types,
which produce implicit declarations of all primitive operations,
including "Foo_Op" in this case.
 
> Pascal.

-- 
-Tucker Taft   stt@averstar.com   http://www.averstar.com/~stt/
Technical Director, Distributed IT Solutions  (www.averstar.com/tools)
AverStar (formerly Intermetrics, Inc.)   Burlington, MA  USA




^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: GNAT bug?
  1999-02-10  0:00 ` Pascal Obry
@ 1999-02-10  0:00   ` Tucker Taft
  1999-02-11  0:00     ` Pascal Obry
  0 siblings, 1 reply; 16+ messages in thread
From: Tucker Taft @ 1999-02-10  0:00 UTC (permalink / raw)


Pascal Obry wrote:
> 
> Juergen.Hoyng@ri.dasa.de a �crit dans le message
> <79ptl3$jdp$1@nnrp1.dejanews.com>...
> >Hello!
> >
> >The followings compilation units can be compiled with the Ada83 compiler
> VADS
> >6.2.3(c) (Solaris 2.5.1) and Alsys 5.5.4 (HP_UX 10.20).
> >
> 
> [code removed]
> 
> >
> >When trying to compile these compilation units with gnat-3.11p (Solaris
> 2.5.1)
> >I got the error message:
> >x.adb:6:15: expected private type "My_Foo_Type" defined at x.ads:4
> >x.adb:6:15: found type "My_Foo_Type" defined at x.ads:4
> >
> >Is this an Ada95/Ada83 incompatibility or a GNAT bug?
> >
> 
> Your program is wrong :
> 
> Firstly Foo_Op is not visible. The X is defined as a new type so you must
> do a type convertion.

I don't agree.

The declaration of My_Foo_Type causes an implicit
declaration of another "Foo_Op" which takes My_Foo_Type
parameters.

> ... The offending line should read :
> 
>     My_Foo.Foo_Op (My_Foo.Foo_Type (X), My_Foo.Foo_Type (Y));
> 
> You can avoid the type convertion by using subtype instead of type for
> My_Foo_Type
> in package X.

This is not necessary.  Derived type definitions produce
implicit declarations of all "primitive" operations, including
Foo_Op in this case.

> Pascal.

-- 
-Tucker Taft   stt@averstar.com   http://www.averstar.com/~stt/
Technical Director, Distributed IT Solutions  (www.averstar.com/tools)
AverStar (formerly Intermetrics, Inc.)   Burlington, MA  USA




^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: GNAT bug?
  1999-02-10  0:00   ` Tucker Taft
@ 1999-02-11  0:00     ` Pascal Obry
  0 siblings, 0 replies; 16+ messages in thread
From: Pascal Obry @ 1999-02-11  0:00 UTC (permalink / raw)


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 1053 bytes --]


Tucker Taft a �crit dans le message <36C1AA73.D29EF34A@averstar.com>...
>Pascal Obry wrote:
>>
>> Juergen.Hoyng@ri.dasa.de a �crit dans le message
>> <79ptl3$jdp$1@nnrp1.dejanews.com>...
>> >Hello!
>> >
>> >The followings compilation units can be compiled with the Ada83 compiler
>> VADS
>> >6.2.3(c) (Solaris 2.5.1) and Alsys 5.5.4 (HP_UX 10.20).
>> >
>>
>> [code removed]
>>
>> >
>> >When trying to compile these compilation units with gnat-3.11p (Solaris
>> 2.5.1)
>> >I got the error message:
>> >x.adb:6:15: expected private type "My_Foo_Type" defined at x.ads:4
>> >x.adb:6:15: found type "My_Foo_Type" defined at x.ads:4
>> >
>> >Is this an Ada95/Ada83 incompatibility or a GNAT bug?
>> >
>>
>> Your program is wrong :
>>
>> Firstly Foo_Op is not visible. The X is defined as a new type so you must
>> do a type convertion.
>
>I don't agree.
>
>The declaration of My_Foo_Type causes an implicit
>declaration of another "Foo_Op" which takes My_Foo_Type
>parameters.
>

Right, I have overlooked that !

Sorry for the confusion.

Pascal.







^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: GNAT bug?
  1999-02-09  0:00 ` Stephen Leake
  1999-02-10  0:00   ` Pascal Obry
@ 1999-02-11  0:00   ` Juergen.Hoyng
  1 sibling, 0 replies; 16+ messages in thread
From: Juergen.Hoyng @ 1999-02-11  0:00 UTC (permalink / raw)



> The program compiles without error in ObjectAda; submit a GNAT bug report.
>
> -- Stephe
>

I submitted a GNAT bug report yesterday.

It seems, that GNAT does not handle derived types in combination with
generic units correctly.

Another example:

with Unchecked_Deallocation;
package String_Utils; is
   type String_Access is access String;
   procedure Free is new Unchecked_Deallocation (String, String_Access);
end String_Utils;

with String_Utils;
procedure Main is
  type Derived_From_String_Access is new String_Utils.String_Access;
  X : Derived_From_String_Access;
begin
  Free(X);
end Main;
main.adb:6:03: expected type "String_Access" defined at string_utils.ads:3
main.adb:6:03: found type "Derived_From_String_Access" defined at line 3
main.adb:6:03: expected type "Derived_From_String_Access" defined at line 3
main.adb:6:03: found type "String_Access" defined at string_utils.ads:3

It is a little surprising that nobody has found this bug in the past.



Juergen Hoyng,  RIO 62             |   email : Juergen.Hoyng@ri.dasa.de
DaimlerChrysler Aerospace AG       |   fax   : +49 421 539 4529
Raumfahrt Infrastruktur            |
Postfach 286156                    |   voice : +49 421 539 5348
D-28361 Bremen                     |
Germany

-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/       Search, Read, Discuss, or Start Your Own    




^ permalink raw reply	[flat|nested] 16+ messages in thread

* GNAT bug?
@ 2006-10-27  7:57 Maciej Sobczak
  2006-10-27  9:03 ` Stephen Leake
  0 siblings, 1 reply; 16+ messages in thread
From: Maciej Sobczak @ 2006-10-27  7:57 UTC (permalink / raw)


Hi,

Consider this example code:

procedure Protected_Test is

    protected type P is
       entry E;
    end P;

    protected body P is
       entry E when True is
       begin
          null;
       end E;
    end P;

    Pr : P;

begin
    Pr.E;
end Protected_Test; :

and then:

$ gnatmake -gnatv -gnatwd protected_test

GNAT GPL 2005 (20050729)
Copyright 1992-2005 Free Software Foundation, Inc.

Compiling: protected_test.adb (source file time stamp: 2006-10-26 21:53:50)

      8.       entry E when True is
               |
         >>> warning: implicit dereference

  18 lines: No errors, 1 warning
gnatbind -x protected_test.ali
gnatlink protected_test.ali


The -gnatwd option is used to warn against implicit .all when access 
variable is used to access record components and has nothing to do with 
protected objects. Removing one of the options is enough to make the 
compiler happy with the entry keyword, but then the protection against 
implicit .all is lost.

Is it a bug or a feature?

-- 
Maciej Sobczak : http://www.msobczak.com/
Programming    : http://www.msobczak.com/prog/



^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: GNAT bug?
  2006-10-27  7:57 Maciej Sobczak
@ 2006-10-27  9:03 ` Stephen Leake
  2006-10-27 17:25   ` Martin Krischik
  0 siblings, 1 reply; 16+ messages in thread
From: Stephen Leake @ 2006-10-27  9:03 UTC (permalink / raw)


Maciej Sobczak <no.spam@no.spam.com> writes:

> GNAT GPL 2005 (20050729)

Try GNAT GPL 2006

-- 
-- Stephe



^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: GNAT bug?
  2006-10-27  9:03 ` Stephen Leake
@ 2006-10-27 17:25   ` Martin Krischik
  2006-10-27 18:21     ` Pascal Obry
  2006-10-27 18:30     ` (see below)
  0 siblings, 2 replies; 16+ messages in thread
From: Martin Krischik @ 2006-10-27 17:25 UTC (permalink / raw)


Stephen Leake wrote:

> Maciej Sobczak <no.spam@no.spam.com> writes:
> 
>> GNAT GPL 2005 (20050729)
> 
> Try GNAT GPL 2006

Won't help. The problem has been there ever since I use GNAT and in every
version I know of (I am an -Wall,-W4,-Wwhatever junky - I know).

Martin
-- 
mailto://krischik@users.sourceforge.net
Ada programming at: http://ada.krischik.com



^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: GNAT bug?
  2006-10-27 17:25   ` Martin Krischik
@ 2006-10-27 18:21     ` Pascal Obry
  2006-10-27 18:30     ` (see below)
  1 sibling, 0 replies; 16+ messages in thread
From: Pascal Obry @ 2006-10-27 18:21 UTC (permalink / raw)
  To: Martin Krischik

Martin Krischik a �crit :
> Won't help. The problem has been there ever since I use GNAT and in every
> version I know of (I am an -Wall,-W4,-Wwhatever junky - I know).

Time to report it ?

Pascal.

-- 

--|------------------------------------------------------
--| Pascal Obry                           Team-Ada Member
--| 45, rue Gabriel Peri - 78114 Magny Les Hameaux FRANCE
--|------------------------------------------------------
--|              http://www.obry.net
--| "The best way to travel is by means of imagination"
--|
--| gpg --keyserver wwwkeys.pgp.net --recv-key C1082595



^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: GNAT bug?
  2006-10-27 17:25   ` Martin Krischik
  2006-10-27 18:21     ` Pascal Obry
@ 2006-10-27 18:30     ` (see below)
  1 sibling, 0 replies; 16+ messages in thread
From: (see below) @ 2006-10-27 18:30 UTC (permalink / raw)


On 27/10/06 18:25, in article 15502511.igE44K045W@linux1.krischik.com,
"Martin Krischik" <krischik@users.sourceforge.net> wrote:

> Stephen Leake wrote:
> 
>> Maciej Sobczak <no.spam@no.spam.com> writes:
>> 
>>> GNAT GPL 2005 (20050729)
>> 
>> Try GNAT GPL 2006
> 
> Won't help. The problem has been there ever since I use GNAT and in every
> version I know of (I am an -Wall,-W4,-Wwhatever junky - I know).

On MacOS X 10.4.8:

$gnatmake -gnatv -gnatwd protected_test
gcc -c -gnatv -gnatwd protected_test.adb

GNAT GPL 2006 (20060522-34)
Copyright 1992-2006, Free Software Foundation, Inc.

Compiling: protected_test.adb (source file time stamp: 2006-10-27 18:23:48)
 18 lines: No errors
gnatbind -x protected_test.ali
gnatlink protected_test.ali

$ ls
protected_test          protected_test.o
Protected_Test.adb      protected_test.ali

$ ./protected_test 
$ 

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




^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: GNAT bug?
@ 2006-10-27 20:39 Anh Vo
  0 siblings, 0 replies; 16+ messages in thread
From: Anh Vo @ 2006-10-27 20:39 UTC (permalink / raw)
  To: comp.lang.ada

<< >>> "(see below)" <yaldnif.w@blueyonder.co.uk> 10/27/2006 11:30 AM
>>>
On 27/10/06 18:25, in article 15502511.igE44K045W@linux1.krischik.com,
"Martin Krischik" <krischik@users.sourceforge.net> wrote:

> Stephen Leake wrote:
> 
>> Maciej Sobczak <no.spam@no.spam.com> writes:
>> 
>>> GNAT GPL 2005 (20050729)
>> 
>> Try GNAT GPL 2006
> 
> Won't help. The problem has been there ever since I use GNAT and in
every
> version I know of (I am an -Wall,-W4,-Wwhatever junky - I know).

On MacOS X 10.4.8:

$gnatmake -gnatv -gnatwd protected_test
gcc -c -gnatv -gnatwd protected_test.adb

GNAT GPL 2006 (20060522-34)
Copyright 1992-2006, Free Software Foundation, Inc.

Compiling: protected_test.adb (source file time stamp: 2006-10-27
18:23:48)
 18 lines: No errors
gnatbind -x protected_test.ali
gnatlink protected_test.ali

$ ls
protected_test          protected_test.o
Protected_Test.adb      protected_test.ali

$ ./protected_test 
$ >>

On my PC running Win 2k, it works fine also. See the output below.

E:\Ada\Ada_Discussion\Is_It_A_Bug>gnatmake -gnatv -gnatwd
protected_test
gcc -c -gnatv -gnatwd protected_test.adb

GNAT GPL 2006 (20060522-34)
Copyright 1992-2006, Free Software Foundation, Inc.

Compiling: protected_test.adb (source file time stamp: 2006-10-27
20:31:28)
 19 lines: No errors
gnatbind -x protected_test.ali
gnatlink protected_test.ali

E:\Ada\Ada_Discussion\Is_It_A_Bug>protected_test.exe

E:\Ada\Ada_Discussion\Is_It_A_Bug>




^ permalink raw reply	[flat|nested] 16+ messages in thread

end of thread, other threads:[~2006-10-27 20:39 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-10-27 20:39 GNAT bug? Anh Vo
  -- strict thread matches above, loose matches on Subject: below --
2006-10-27  7:57 Maciej Sobczak
2006-10-27  9:03 ` Stephen Leake
2006-10-27 17:25   ` Martin Krischik
2006-10-27 18:21     ` Pascal Obry
2006-10-27 18:30     ` (see below)
1999-02-09  0:00 Juergen.Hoyng
1999-02-09  0:00 ` Stephen Leake
1999-02-10  0:00   ` Pascal Obry
1999-02-10  0:00     ` Tucker Taft
1999-02-11  0:00   ` Juergen.Hoyng
1999-02-10  0:00 ` Pascal Obry
1999-02-10  0:00   ` Tucker Taft
1999-02-11  0:00     ` Pascal Obry
1998-02-27  0:00 Haug Buerger
1998-02-28  0:00 ` Jerry van Dijk

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