comp.lang.ada
 help / color / mirror / Atom feed
* gnat 3.15p with kernel 2.6 / SuSE 9.1
@ 2004-10-01 10:29 Thomas Aho
  2004-10-01 10:40 ` Florian Weimer
  2004-10-01 10:46 ` Ptr Problem Question Arthur Schwarz
  0 siblings, 2 replies; 9+ messages in thread
From: Thomas Aho @ 2004-10-01 10:29 UTC (permalink / raw)


I have a problem with gnat 3.14p hanging on a SuSE 9.1 system (kernel
2.6). As soon as there are tasks involved, the program hangs, as soon
as the task is being activated. An example:

with Text_Io;

procedure Amain is

   task type Tt is
      entry Start;
      entry Stop;
   end;

task body Tt is
   Exit_Flag : Boolean := False;
begin
   accept Start;
   while not Exit_Flag Loop
      Text_Io.Put_Line("hello");
      select
         accept Stop;
         Exit_Flag := True;
      or delay 1.0;
      end select;
   end loop;
end;

begin
   Text_Io.Put_Line("start");
   declare
      T1 : Tt;
      begin
         t1.Start;
         delay 5.0;
         T1.Stop;
      end;
end Amain;


This program will only report "start", and then nothing more.

I have made sure that the gcc that is found is 2.8.1 (which is the
backend for gnat 3.15), so there is no gcc2-gcc3 conflict.
Does anyone have experinced similar problems?

/Thomas Aho



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

* Re: gnat 3.15p with kernel 2.6 / SuSE 9.1
  2004-10-01 10:29 gnat 3.15p with kernel 2.6 / SuSE 9.1 Thomas Aho
@ 2004-10-01 10:40 ` Florian Weimer
  2004-10-01 13:24   ` Marc A. Criley
  2004-10-01 10:46 ` Ptr Problem Question Arthur Schwarz
  1 sibling, 1 reply; 9+ messages in thread
From: Florian Weimer @ 2004-10-01 10:40 UTC (permalink / raw)


* Thomas Aho:

> I have a problem with gnat 3.14p hanging on a SuSE 9.1 system (kernel
> 2.6). As soon as there are tasks involved, the program hangs, as soon
> as the task is being activated. An example:

You need LD_ASSUME_KERNEL=2.4.0 or something similar.  This should be
documented in the SuSE release notes.



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

* Ptr Problem Question
  2004-10-01 10:29 gnat 3.15p with kernel 2.6 / SuSE 9.1 Thomas Aho
  2004-10-01 10:40 ` Florian Weimer
@ 2004-10-01 10:46 ` Arthur Schwarz
  2004-10-01 11:04   ` Marius Amado Alves
  2004-10-01 18:12   ` Jeffrey Carter
  1 sibling, 2 replies; 9+ messages in thread
From: Arthur Schwarz @ 2004-10-01 10:46 UTC (permalink / raw)


Each Ptr assignment below yields the following error message:

--    9.    Ptr     : a.X_Ptr  := Object'Access;
--       >>> non-local pointer cannot point to local object

In the past, the only way that I seem to be able to fix the problem is to
put the pointer and assignment in global space (either in file global or in
a package spec). I've looked at Ada as a Second Language (Cohen) and, with
less diligence, at the Ada LRM but can't figure what I'm doing wrong. What
am I doing wrong?

art

-----------------------------------------------------------
-----------------------------------------------------------

package a is
   type X     is new Integer;
   type X_Ptr is access all X;
end a;

--------------------------------------------------------

with a;

Procedure b is
   subtype Y         is a.X;
   subtype Y_Ptr     is a.X_Ptr;

   Object  : aliased a.X;
   Object_Y: aliased Y;
   Ptr     : a.X_Ptr  := Object'Access;
   Ptr_Y   : Y_Ptr    := Object'Access;
   Ptr_OY  : a.X_Ptr  := Object'Access;
   Ptr_1Y  : Y_Ptr    := Object'Access;

begin -- b
   Ptr     := Object'Access;
   Ptr_Y   := Object'Access;
end b;





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

* Re: Ptr Problem Question
  2004-10-01 10:46 ` Ptr Problem Question Arthur Schwarz
@ 2004-10-01 11:04   ` Marius Amado Alves
  2004-10-01 18:12   ` Jeffrey Carter
  1 sibling, 0 replies; 9+ messages in thread
From: Marius Amado Alves @ 2004-10-01 11:04 UTC (permalink / raw)
  To: comp.lang.ada

 > --    9.    Ptr     : a.X_Ptr  := Object'Access;
 > --       >>> non-local pointer cannot point to local object

Hmm... I guess subtyping does not make it local.

If you're in hurry you can always get away with 'Unchecked_Access or 
'Unrestricted_Access.

Otherwise you have to deal with the Ada accessibility rules. And expect 
them to get in your way often.

Or invest in pointerless idioms: http://www.liacc.up.pt/~maa/no_pointers/





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

* Re: gnat 3.15p with kernel 2.6 / SuSE 9.1
  2004-10-01 10:40 ` Florian Weimer
@ 2004-10-01 13:24   ` Marc A. Criley
  2004-10-01 17:15     ` Ludovic Brenta
  0 siblings, 1 reply; 9+ messages in thread
From: Marc A. Criley @ 2004-10-01 13:24 UTC (permalink / raw)


"Florian Weimer" <fw@deneb.enyo.de> wrote:
> * Thomas Aho:
>
> > I have a problem with gnat 3.14p hanging on a SuSE 9.1 system (kernel
> > 2.6). As soon as there are tasks involved, the program hangs, as soon
> > as the task is being activated. An example:
>
> You need LD_ASSUME_KERNEL=2.4.0 or something similar.  This should be
> documented in the SuSE release notes.

I ran into this issue developing and running DTraq on Red Hat 9, so I've got
a writeup on it at http://mckae.com/dtq_common/README.RedHat9.

Marc A. Criley
McKae Technologies
www.mckae.com





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

* Re: gnat 3.15p with kernel 2.6 / SuSE 9.1
  2004-10-01 13:24   ` Marc A. Criley
@ 2004-10-01 17:15     ` Ludovic Brenta
  2004-10-04  8:36       ` Alex R. Mosteo
  0 siblings, 1 reply; 9+ messages in thread
From: Ludovic Brenta @ 2004-10-01 17:15 UTC (permalink / raw)


"Marc A. Criley" writes:
> "Florian Weimer" wrote:
>> * Thomas Aho:
>>
>> > I have a problem with gnat 3.14p hanging on a SuSE 9.1 system (kernel
>> > 2.6). As soon as there are tasks involved, the program hangs, as soon
>> > as the task is being activated. An example:
>>
>> You need LD_ASSUME_KERNEL=2.4.0 or something similar.  This should be
>> documented in the SuSE release notes.
>
> I ran into this issue developing and running DTraq on Red Hat 9, so I've got
> a writeup on it at http://mckae.com/dtq_common/README.RedHat9.

And it is also documented in the Debian Policy for Ada, along with
many other things:

http://users.skynet.be/ludovic.brenta/debian-ada-policy.html

-- 
Ludovic Brenta.



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

* Re: Ptr Problem Question
  2004-10-01 10:46 ` Ptr Problem Question Arthur Schwarz
  2004-10-01 11:04   ` Marius Amado Alves
@ 2004-10-01 18:12   ` Jeffrey Carter
  1 sibling, 0 replies; 9+ messages in thread
From: Jeffrey Carter @ 2004-10-01 18:12 UTC (permalink / raw)


Arthur Schwarz wrote:

> Each Ptr assignment below yields the following error message:
> 
> --    9.    Ptr     : a.X_Ptr  := Object'Access;
> --       >>> non-local pointer cannot point to local object

A.X_Ptr is declared at the library level. This means that you could 
assign Ptr to a variable declared at the library level, and it would 
exist after the subprogram returns, leaving a dangling reference. Ada's 
accessibility rules prevent this.

If you're sure this won't happen, you can use 'Unchecked_Access instead. 
You are then responsible for making sure you don't leave any dangling 
refererences; the compiler can't help you.

A better question, though, is why you are using pointers. Unless you're 
building a dynamic data structure, pointers are rarely needed in Ada.

-- 
Jeff Carter
"You cheesy lot of second-hand electric donkey-bottom biters."
Monty Python & the Holy Grail
14




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

* Re: gnat 3.15p with kernel 2.6 / SuSE 9.1
  2004-10-01 17:15     ` Ludovic Brenta
@ 2004-10-04  8:36       ` Alex R. Mosteo
  2004-10-05  6:35         ` Thomas Aho
  0 siblings, 1 reply; 9+ messages in thread
From: Alex R. Mosteo @ 2004-10-04  8:36 UTC (permalink / raw)


Ludovic Brenta wrote:
> "Marc A. Criley" writes:
> 
>>"Florian Weimer" wrote:
>>
>>>* Thomas Aho:
>>>
>>>
>>>>I have a problem with gnat 3.14p hanging on a SuSE 9.1 system (kernel
>>>>2.6). As soon as there are tasks involved, the program hangs, as soon
>>>>as the task is being activated. An example:
>>>
>>>You need LD_ASSUME_KERNEL=2.4.0 or something similar.  This should be
>>>documented in the SuSE release notes.
>>
>>I ran into this issue developing and running DTraq on Red Hat 9, so I've got
>>a writeup on it at http://mckae.com/dtq_common/README.RedHat9.
> 
> 
> And it is also documented in the Debian Policy for Ada, along with
> many other things:
> 
> http://users.skynet.be/ludovic.brenta/debian-ada-policy.html

Interesting read!



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

* Re: gnat 3.15p with kernel 2.6 / SuSE 9.1
  2004-10-04  8:36       ` Alex R. Mosteo
@ 2004-10-05  6:35         ` Thomas Aho
  0 siblings, 0 replies; 9+ messages in thread
From: Thomas Aho @ 2004-10-05  6:35 UTC (permalink / raw)


"Alex R. Mosteo" <devnull@mailinator.com> wrote in message news:<41610B84.1050408@mailinator.com>...
> Ludovic Brenta wrote:
> > "Marc A. Criley" writes:
> > 
> >>"Florian Weimer" wrote:
> >>
> >>>* Thomas Aho:
> >>>
> >>>
> >>>>I have a problem with gnat 3.14p hanging on a SuSE 9.1 system (kernel
> >>>>2.6). As soon as there are tasks involved, the program hangs, as soon
> >>>>as the task is being activated. An example:
> >>>
> >>>You need LD_ASSUME_KERNEL=2.4.0 or something similar.  This should be
> >>>documented in the SuSE release notes.
> >>
> >>I ran into this issue developing and running DTraq on Red Hat 9, so I've got
> >>a writeup on it at http://mckae.com/dtq_common/README.RedHat9.
> > 
> > 
> > And it is also documented in the Debian Policy for Ada, along with
> > many other things:
> > 
> > http://users.skynet.be/ludovic.brenta/debian-ada-policy.html
> 
> Interesting read!

Thanks for the help. It really helped me out.

BTW; it seems to be an issue not only for Ada-programs, but for some
other "normal" C++-programs as well. I have one aplication that
compiles and links without problams, but it crashes when not defining
LD_ASSUME_KERNEL=2.4. We are looking into that now, and it is probably
a matter of doing things that have always been questionable (like
terminating non-existing threads) but happened to work (by luck) with
the old threading model, but not with the new one.

/Thomas



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

end of thread, other threads:[~2004-10-05  6:35 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-10-01 10:29 gnat 3.15p with kernel 2.6 / SuSE 9.1 Thomas Aho
2004-10-01 10:40 ` Florian Weimer
2004-10-01 13:24   ` Marc A. Criley
2004-10-01 17:15     ` Ludovic Brenta
2004-10-04  8:36       ` Alex R. Mosteo
2004-10-05  6:35         ` Thomas Aho
2004-10-01 10:46 ` Ptr Problem Question Arthur Schwarz
2004-10-01 11:04   ` Marius Amado Alves
2004-10-01 18:12   ` Jeffrey Carter

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