Version 1.1 of acs/ac-00236.txt

Unformatted version of acs/ac-00236.txt version 1.1
Other versions for file acs/ac-00236.txt

!standard E.2.1          12-06-06 AC95-00236/00
!class confirmation 12-06-06
!status received no action 12-06-06
!status received 12-05-24
!subject Aliased variables in Shared_Passive packages?

From: Adam Beneschan
Sent: Thursday, May 24, 2012  1:39 PM

!topic Aliased variables in Shared_Passive packages?
!reference E.2.1
!from Adam Beneschan 12-05-24

Should this be legal?

    package Pack1 is
        pragma Shared_Passive;
        Var1 : aliased Integer;
    end Pack1;

    package Pack2 is
        type Int_Acc is access all Integer;
        Current_Acc : Int_Acc;
    end Pack2;

    package Pack3 is
        procedure Proc;
    end Pack3;

    with Pack1;
    with Pack2;
    package body Pack3 is
        procedure Proc is
            Pack2.Current_Acc := Pack1.Var1'access;
        end Proc;
    end Pack3;

After Proc is executed, what would happen if some other procedure dereferenced
Current_Acc (assuming Pack1 is not in the same partition as Pack2 and Pack3)?
Maybe I'm missing something, but I don't see a reasonable way that this could be
made to work without adding extra data to Int_Acc and forcing every dereference
of an Int_Acc to see if it refers to a variable in another partition (or some
sort of OS support).  But I don't see anything in the language that prohibits
this code.


From: Tucker Taft
Sent: Thursday, May 24, 2012  1:39 PM

The model for passive partitions is that they are mapped into the address space
of active partitions that depend on them.  So there is nothing special here.
Similar problems would occur if you passed a tagged object declared in a passive
partition as a parameter, since such objects are required to be passed by

Quoting from E.1(2):

   ... A passive partition is a partition that has no thread of
   control of its own, whose library units are all preelaborated,
   and whose data and subprograms are accessible to one or more
   active partitions.

If your operating system doesn't support mapping shared memory, then you
probably couldn't support passive partitions that are visible to multiple active


Questions? Ask the ACAA Technical Agent