comp.lang.ada
 help / color / mirror / Atom feed
* Pragma Import don't suppress access initialization
@ 2002-10-07 12:10 Frédéric Ormancey
  2002-10-07 17:25 ` Matthew Heaney
  2002-10-07 17:25 ` Craig Carey
  0 siblings, 2 replies; 4+ messages in thread
From: Frédéric Ormancey @ 2002-10-07 12:10 UTC (permalink / raw)


Hi,

I was using a 'Address to cast system.address type to an access type,
which work fine with GNAT 3.13 but cause an eroneous intialization and
erase my access value with NULL when compiled with GNAT 3.14p ( I'am
doing a migration from GNAT 3.13 to GNAT 3.14 ).

Code look like this :

   function Analyser_Formule (Varset : in System.ADDRESS) return
Integer is
     V : Ty_Varset;
     for V use at Varset;
     pragma Import (Ada, V);

where Ty_Varset is declared in another package :

    type Varset(Nature : Character; Taille : Integer);
    type Ty_Varset is access Varset;

I use the pragma Import to avoid the compiler warning : "implicit
initialization of V may modify overlaid storage, use pragma Import for
V to suppress initialization (RM B(24))" as describe in the GNAT_RM
documentation / Address_Clauses chapter.

Unfortunatly the implicit initialization of V erase the Varset
parameter of the fonction and force it to 0x0 value, and the pragma
Import clause has no effect :-(

Does anybody have a solution to avoid this value erasure ?

Thanks.



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

* Re: Pragma Import don't suppress access initialization
  2002-10-07 12:10 Pragma Import don't suppress access initialization Frédéric Ormancey
@ 2002-10-07 17:25 ` Matthew Heaney
  2002-10-07 19:49   ` Jeffrey Carter
  2002-10-07 17:25 ` Craig Carey
  1 sibling, 1 reply; 4+ messages in thread
From: Matthew Heaney @ 2002-10-07 17:25 UTC (permalink / raw)


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


"Fr�d�ric Ormancey" <frederic.ormancey@atosorigin.com> wrote in message
news:9c9fb8b4.0210070410.fa84429@posting.google.com...
>
> Code look like this :
>
>    function Analyser_Formule (Varset : in System.ADDRESS)
>     return Integer is
>      V : Ty_Varset;
>      for V use at Varset;
>      pragma Import (Ada, V);
>
> where Ty_Varset is declared in another package :
>
>     type Varset(Nature : Character; Taille : Integer);
>     type Ty_Varset is access Varset;

What's wrong with System.Address_To_Access_Conversions?

  V : Object_Pointer := To_Pointer (Varset);







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

* Re: Pragma Import don't suppress access initialization
  2002-10-07 12:10 Pragma Import don't suppress access initialization Frédéric Ormancey
  2002-10-07 17:25 ` Matthew Heaney
@ 2002-10-07 17:25 ` Craig Carey
  1 sibling, 0 replies; 4+ messages in thread
From: Craig Carey @ 2002-10-07 17:25 UTC (permalink / raw)



On 7 Oct 2002 05:10:32 -0700, frederic.ormancey@atosorigin.com (Fr�d�ric
Ormancey) wrote:

>I was using a X'Address to cast system.address type to an access type,
>which works fine with GNAT 3.13 but cause an erroneous intialization and
>erase my access value with NULL when compiled with GNAT 3.14p ( I'am
>doing a migration from GNAT 3.13 to GNAT 3.14 ).
...

Unchecked conversion is a way of converting types and examples are in
GNAT's Annex B interfacing packages.

I reported what seems to be that same "Import" bug in March 2002 to
report@gnat.com. I did not get a tracking number so they probably knew
of it by 23 March 2002. [The example can be about as simple as possible].

Here is an example of a tracking number in the acknowledgement to an
unsupported customer. This number/code is "B927-006":

"[B927-006 public] Default initialization of controlled field not done in
 [nested] 2nd case [statement] in variant; ...".

That was 1 of 3 I sent in the last 12 days. I seem to have about maybe
2 in 3 reports be ignored (not in first).


Craig Carey
 Mailing lists
  http://www.ijs.co.nz/ada_95.htm






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

* Re: Pragma Import don't suppress access initialization
  2002-10-07 17:25 ` Matthew Heaney
@ 2002-10-07 19:49   ` Jeffrey Carter
  0 siblings, 0 replies; 4+ messages in thread
From: Jeffrey Carter @ 2002-10-07 19:49 UTC (permalink / raw)


Matthew Heaney wrote:
> "Fr�d�ric Ormancey" <frederic.ormancey@atosorigin.com> wrote in message
> news:9c9fb8b4.0210070410.fa84429@posting.google.com...
> 
>>   function Analyser_Formule (Varset : in System.ADDRESS)
>>    return Integer is
>>     V : Ty_Varset;
>>     for V use at Varset;
>>     pragma Import (Ada, V);
>>
>>where Ty_Varset is declared in another package :
>>
>>    type Varset(Nature : Character; Taille : Integer);
>>    type Ty_Varset is access Varset;
> 
> What's wrong with System.Address_To_Access_Conversions?
> 
>   V : Object_Pointer := To_Pointer (Varset);

Note that he is not using Varset as an access value as you are 
suggesting; he is using it as the address of an access object. That may 
be his problem, but we can't tell.

-- 
Jeff Carter
"Have you gone berserk? Can't you see that that man is a ni?"
Blazing Saddles




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

end of thread, other threads:[~2002-10-07 19:49 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-10-07 12:10 Pragma Import don't suppress access initialization Frédéric Ormancey
2002-10-07 17:25 ` Matthew Heaney
2002-10-07 19:49   ` Jeffrey Carter
2002-10-07 17:25 ` Craig Carey

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