* strange error in tiny ada 2012 program
@ 2012-07-06 21:55 Charly
2012-07-07 0:36 ` Adam Beneschan
2012-07-07 10:25 ` Georg Bauhaus
0 siblings, 2 replies; 3+ messages in thread
From: Charly @ 2012-07-06 21:55 UTC (permalink / raw)
Hi all
I installed the new GNAT GPL 2012 and started playing with the new Synchronized_Queue Containers.
Unfortunately I got serverall problems, which can be shown in the following tiny test program
1 with Ada.Containers.Synchronized_Queue_Interfaces;
2 with Ada.Containers.Bounded_Synchronized_Queues;
3 with Ada.Text_IO;
4
5 procedure Ctest is
6
7
8 package Integer_Queue_Interfaces is
9 new Ada.Containers.Synchronized_Queue_Interfaces (Integer);
10
11 package Integer_Queues is
12 new Ada.Containers.Bounded_Synchronized_Queues (Integer_Queue_Interfaces, 10);
13
14 subtype Integer_Queue_Type is Integer_Queues.Queue;
15
16 -- type New_Integer_Queue_Type is new Integer_Queue_Type with null record;
17
18 type Integer_Queue_Record is tagged limited record
19 Queue : Integer_Queue_Type;
20 end record;
21
22 --Integer_Queue1 : Integer_Queue_Type;
23 Integer_Queue2 : Integer_Queue_Record;
24
25 begin
26
27 Ada.Text_IO.Put_Line ("Hello Ada");
28
29 end Ctest;
First problem occured in line 16 where I want to extend the Integer_Queue_Type
but I got an error message:
ctest.adb:16:04: parent type of a record extension cannot be a synchronized tagged type (RM 3.9.1 (3/1))
So I removed the statement and defined a new tagged type with the Integer_Queue_Type as record element
in lines 18 - 20. This variant compiles without messages but now I get an exception STORAGE_ERROR.
addr2line locates the error in line 5 what isn't very usefull. By trial and error I found, that the
error comes from line 23, when I replace it with line 22 the program 'works'.
So my questions are:
Did I make any mistake in this tiny program or is it a bug in the new GNAT version?
How can a extend a proteced type (line 16).
Thanks
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: strange error in tiny ada 2012 program
2012-07-06 21:55 strange error in tiny ada 2012 program Charly
@ 2012-07-07 0:36 ` Adam Beneschan
2012-07-07 10:25 ` Georg Bauhaus
1 sibling, 0 replies; 3+ messages in thread
From: Adam Beneschan @ 2012-07-07 0:36 UTC (permalink / raw)
On Friday, July 6, 2012 2:55:53 PM UTC-7, Charly wrote:
> So my questions are:
> Did I make any mistake in this tiny program or is it a bug in the new GNAT version?
> How can a extend a proteced type (line 16).
I have no idea about the STORAGE_ERROR issue, but the answer to the second one is simple: you can't. The following paragraph from AI95-345 appears to be the main reason:
An important advantage of eliminating inheritance of any code or data
for tasks and protected types is that the "monitor"-like benefits of
these constructs are preserved. All of the synchronizing operations are
implemented in a single module, simplifying analysis and avoiding any
inheritance "anomalies" that have been associated in the literature with
combining inheritance with synchronization.
-- Adam
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: strange error in tiny ada 2012 program
2012-07-06 21:55 strange error in tiny ada 2012 program Charly
2012-07-07 0:36 ` Adam Beneschan
@ 2012-07-07 10:25 ` Georg Bauhaus
1 sibling, 0 replies; 3+ messages in thread
From: Georg Bauhaus @ 2012-07-07 10:25 UTC (permalink / raw)
On 06.07.12 23:55, Charly wrote:
> How can a extend a proteced type
Make another protected type that implements the
same interface. Use the original behind the scene.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2012-07-07 10:25 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-07-06 21:55 strange error in tiny ada 2012 program Charly
2012-07-07 0:36 ` Adam Beneschan
2012-07-07 10:25 ` Georg Bauhaus
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox