* [PATCH] ada: Remove changes to a-tasatt.adb
@ 2007-11-11 9:26 Samuel Tardieu
2007-11-13 14:09 ` Olivier Hainque
0 siblings, 1 reply; 6+ messages in thread
From: Samuel Tardieu @ 2007-11-11 9:26 UTC (permalink / raw)
To: gcc-patches
The latest changes made to a-tasatt.adb caused a bug when the generic
package Ada.Task_Attributes was instantiated in a local context. In
this case, objects identified to be at the top-level when the generic
was instantiated are not anymore at the top-level at instantiation
time (as they are included in the local context from where the
instantiation happens).
I checked in the following patch which reverts parts of my previous
commit changing 'Unchecked_Access into 'Access. The other bits were
fine.
Bootstrapped and tested on i686-pc-linux-gnu.
* a-tasatt.adb: Revert previous change for this file as it will
generate an error when this package is instantiated from a
local context.
diff --git a/gcc/ada/a-tasatt.adb b/gcc/ada/a-tasatt.adb
index cd20591..97e024c 100644
--- a/gcc/ada/a-tasatt.adb
+++ b/gcc/ada/a-tasatt.adb
@@ -415,7 +415,7 @@ package body Ada.Task_Attributes is
POP.Lock_RTS;
while P /= null loop
- if P.Instance = Access_Instance'(Local'Access) then
+ if P.Instance = Access_Instance'(Local'Unchecked_Access) then
POP.Unlock_RTS;
Undefer_Abort (Self_Id);
return To_Access_Wrapper (P.Wrapper).Value'Access;
@@ -429,10 +429,11 @@ package body Ada.Task_Attributes is
-- holding any other lock.
POP.Unlock_RTS;
- W := new Wrapper'((null, Local'Access, null), Initial_Value);
+ W := new Wrapper'
+ ((null, Local'Unchecked_Access, null), Initial_Value);
POP.Lock_RTS;
- P := W.Dummy_Node'Access;
+ P := W.Dummy_Node'Unchecked_Access;
P.Wrapper := To_Access_Dummy_Wrapper (W);
P.Next := To_Access_Node (TT.Indirect_Attributes);
TT.Indirect_Attributes := To_Access_Address (P);
@@ -493,7 +494,7 @@ package body Ada.Task_Attributes is
Q := To_Access_Node (TT.Indirect_Attributes);
while Q /= null loop
- if Q.Instance = Access_Instance'(Local'Access) then
+ if Q.Instance = Access_Instance'(Local'Unchecked_Access) then
if P = null then
TT.Indirect_Attributes := To_Access_Address (Q.Next);
else
@@ -580,7 +581,7 @@ package body Ada.Task_Attributes is
while P /= null loop
- if P.Instance = Access_Instance'(Local'Access) then
+ if P.Instance = Access_Instance'(Local'Unchecked_Access) then
To_Access_Wrapper (P.Wrapper).Value := Val;
POP.Unlock_RTS;
Undefer_Abort (Self_Id);
@@ -594,9 +595,9 @@ package body Ada.Task_Attributes is
-- from using new (i.e the Global_Lock) while holding any other lock.
POP.Unlock_RTS;
- W := new Wrapper'((null, Local'Access, null), Val);
+ W := new Wrapper'((null, Local'Unchecked_Access, null), Val);
POP.Lock_RTS;
- P := W.Dummy_Node'Access;
+ P := W.Dummy_Node'Unchecked_Access;
P.Wrapper := To_Access_Dummy_Wrapper (W);
P.Next := To_Access_Node (TT.Indirect_Attributes);
TT.Indirect_Attributes := To_Access_Address (P);
@@ -668,7 +669,7 @@ package body Ada.Task_Attributes is
P := To_Access_Node (TT.Indirect_Attributes);
while P /= null loop
- if P.Instance = Access_Instance'(Local'Access) then
+ if P.Instance = Access_Instance'(Local'Unchecked_Access) then
Result := To_Access_Wrapper (P.Wrapper).Value;
POP.Unlock_RTS;
Undefer_Abort (Self_Id);
@@ -723,7 +724,8 @@ begin
-- Add this instantiation to the list of all instantiations
Local.Next := System.Tasking.Task_Attributes.All_Attributes;
- System.Tasking.Task_Attributes.All_Attributes := Local'Access;
+ System.Tasking.Task_Attributes.All_Attributes :=
+ Local'Unchecked_Access;
-- Try to find space for the attribute in the TCB
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] ada: Remove changes to a-tasatt.adb
2007-11-11 9:26 [PATCH] ada: Remove changes to a-tasatt.adb Samuel Tardieu
@ 2007-11-13 14:09 ` Olivier Hainque
2007-11-13 14:15 ` Samuel Tardieu
0 siblings, 1 reply; 6+ messages in thread
From: Olivier Hainque @ 2007-11-13 14:09 UTC (permalink / raw)
To: Samuel Tardieu; +Cc: gcc-patches, hainque
Samuel Tardieu wrote:
> The latest changes made to a-tasatt.adb caused a bug when the generic
> package Ada.Task_Attributes was instantiated in a local context.
> I checked in the following patch which reverts parts of my previous
> commit changing 'Unchecked_Access into 'Access. The other bits were
> fine.
Humm, that ground for the use of 'Unchecked_Access is not obvious and
I think would deserve a comment. Could you please add one ?
And how did your recently suggested warning circuitry behave on
this case ?
Thanks in advance,
Olivier
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] ada: Remove changes to a-tasatt.adb
2007-11-13 14:09 ` Olivier Hainque
@ 2007-11-13 14:15 ` Samuel Tardieu
2007-11-13 15:11 ` Olivier Hainque
2007-11-13 15:15 ` Samuel Tardieu
0 siblings, 2 replies; 6+ messages in thread
From: Samuel Tardieu @ 2007-11-13 14:15 UTC (permalink / raw)
To: Olivier Hainque; +Cc: gcc-patches
On 13/11, Olivier Hainque wrote:
| Samuel Tardieu wrote:
| > The latest changes made to a-tasatt.adb caused a bug when the generic
| > package Ada.Task_Attributes was instantiated in a local context.
|
| > I checked in the following patch which reverts parts of my previous
| > commit changing 'Unchecked_Access into 'Access. The other bits were
| > fine.
|
| Humm, that ground for the use of 'Unchecked_Access is not obvious and
| I think would deserve a comment. Could you please add one ?
Fair enough, I will add one at the beginning of a-tasatt.adb.
| And how did your recently suggested warning circuitry behave on
| this case ?
I will submit a new version of the patch which doesn't add the warning
when compiling a generic and some minor changes we've discussed with
Robert. I'll do that later today or tomorrow.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] ada: Remove changes to a-tasatt.adb
2007-11-13 14:15 ` Samuel Tardieu
@ 2007-11-13 15:11 ` Olivier Hainque
2007-11-13 15:15 ` Samuel Tardieu
1 sibling, 0 replies; 6+ messages in thread
From: Olivier Hainque @ 2007-11-13 15:11 UTC (permalink / raw)
To: Samuel Tardieu; +Cc: gcc-patches, hainque
Samuel Tardieu wrote:
> | Humm, that ground for the use of 'Unchecked_Access is not obvious and
> | I think would deserve a comment. Could you please add one ?
>
> Fair enough, I will add one at the beginning of a-tasatt.adb.
Thanks.
> | And how did your recently suggested warning circuitry behave on
> | this case ?
>
> I will submit a new version of the patch which doesn't add the warning
> when compiling a generic and some minor changes we've discussed with
> Robert. I'll do that later today or tomorrow.
Great. Thanks for your feedback.
Cheers,
Olivier
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] ada: Remove changes to a-tasatt.adb
2007-11-13 14:15 ` Samuel Tardieu
2007-11-13 15:11 ` Olivier Hainque
@ 2007-11-13 15:15 ` Samuel Tardieu
2007-11-13 15:27 ` Olivier Hainque
1 sibling, 1 reply; 6+ messages in thread
From: Samuel Tardieu @ 2007-11-13 15:15 UTC (permalink / raw)
To: Olivier Hainque; +Cc: gcc-patches
On 13/11, Samuel Tardieu wrote:
| Fair enough, I will add one at the beginning of a-tasatt.adb.
Done, checked in as trivial comment patch.
Index: gcc/ada/ChangeLog
===================================================================
--- gcc/ada/ChangeLog (revision 130138)
+++ gcc/ada/ChangeLog (working copy)
@@ -1,3 +1,9 @@
+2007-11-13 Samuel Tardieu <sam@rfc1149.net>
+
+ * a-tasatt.adb: Add a comment at the beginning of the package
+ explaining why in general 'Unchecked_Access must be used instead
+ of 'Access.
+
2007-11-10 Samuel Tardieu <sam@rfc1149.net>
* a-tasatt.adb: Revert previous change for this file as it will
Index: gcc/ada/a-tasatt.adb
===================================================================
--- gcc/ada/a-tasatt.adb (revision 130138)
+++ gcc/ada/a-tasatt.adb (working copy)
@@ -217,6 +217,10 @@
-- "passed" in via access discriminants. GNAT was having trouble with access
-- discriminants, so all this work was moved to the package body.
+-- Note that references to objects declared in this package body must in
+-- general use 'Unchecked_Access instead of 'Access as the package can be
+-- instantiated from within a local context.
+
with System.Error_Reporting;
-- Used for Shutdown;
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] ada: Remove changes to a-tasatt.adb
2007-11-13 15:15 ` Samuel Tardieu
@ 2007-11-13 15:27 ` Olivier Hainque
0 siblings, 0 replies; 6+ messages in thread
From: Olivier Hainque @ 2007-11-13 15:27 UTC (permalink / raw)
To: Samuel Tardieu; +Cc: gcc-patches, hainque
Samuel Tardieu wrote:
> +2007-11-13 Samuel Tardieu <sam@rfc1149.net>
> +
> + * a-tasatt.adb: Add a comment at the beginning of the package
> + explaining why in general 'Unchecked_Access must be used instead
> + of 'Access.
Thanks.
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2007-11-13 14:15 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-11-11 9:26 [PATCH] ada: Remove changes to a-tasatt.adb Samuel Tardieu
2007-11-13 14:09 ` Olivier Hainque
2007-11-13 14:15 ` Samuel Tardieu
2007-11-13 15:11 ` Olivier Hainque
2007-11-13 15:15 ` Samuel Tardieu
2007-11-13 15:27 ` Olivier Hainque
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).