comp.lang.ada
 help / color / mirror / Atom feed
From: "Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de>
Subject: Re: To collection (GNAT bug)
Date: Wed, 4 Oct 2006 20:51:51 +0200
Date: 2006-10-04T20:51:44+02:00	[thread overview]
Message-ID: <16m4sr53fkumr$.h064l3w3xri7.dlg@40tude.net> (raw)
In-Reply-To: 1159982327.758504.26940@i42g2000cwa.googlegroups.com

On 4 Oct 2006 10:18:47 -0700, Adam Beneschan wrote:

> Dmitry A. Kazakov wrote:
>> On Mon, 02 Oct 2006 09:06:42 -0400, Frank J. Lhota wrote:
>>
>>> Dmitry A. Kazakov wrote:
>>>> On Sun, 01 Oct 2006 19:23:26 GMT, Jeffrey R. Carter wrote:
>>>> However, I don't think that it was really the intended behavior in this
>>>> case. [ If access String is a fat pointer, then Unchecked_Conversion should
>>>> not be allowed at all. Otherwise it must honor the String's dope. ]
>>>
>>> I would agree that an unchecked conversion between an address and a fat
>>> pointer (or any two types of different sizes, for that matter) should at
>>> least trigger a warning.
>>
>> Well, actually, it gives a warning, that sizes are different.
> 
> Ummm, wait a minute.  If the sizes are different, why did you think
> that the Unchecked_Conversion would be reversible?  I tried your
> example on GNAT (Linux/x86), and it told me that X'Size=64 and
> Addr'Size=32.  When you convert the 64-bit type to the 32-bit type, of
> course you will lose some information that you won't recover when you
> get it back.  It's mathematically impossible for this to be reversible.

It is quite possible. The dope is obtained by dereferencing the address
being converted. (I assume GNAT stores the dope in that fat pointer.)

If Unchecked_Conversion did not restore a correct pointer under any
thinkable circumstances, then its instantiation should be illegal. After
all, GNAT is not required to provide it when sizes are different.

-- 
Regards,
Dmitry A. Kazakov
http://www.dmitry-kazakov.de



  reply	other threads:[~2006-10-04 18:51 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-09-30 19:46 To collection (GNAT bug) Dmitry A. Kazakov
2006-10-01  1:21 ` Jeffrey R. Carter
2006-10-01  8:00   ` Dmitry A. Kazakov
2006-10-01 19:23     ` Jeffrey R. Carter
2006-10-01 22:33       ` Frank J. Lhota
2006-10-02  3:08         ` Jeffrey R. Carter
2006-10-02 13:02           ` Frank J. Lhota
2006-10-02 19:50             ` Jeffrey R. Carter
2006-10-02  8:23       ` Dmitry A. Kazakov
2006-10-02 13:06         ` Frank J. Lhota
2006-10-02 13:43           ` Dmitry A. Kazakov
2006-10-04 17:18             ` Adam Beneschan
2006-10-04 18:51               ` Dmitry A. Kazakov [this message]
2006-10-02 19:45         ` Jeffrey R. Carter
2006-10-03  8:36           ` Dmitry A. Kazakov
2006-10-03 19:10             ` Jeffrey R. Carter
2006-10-04  8:01               ` Dmitry A. Kazakov
2006-10-04  9:27                 ` Georg Bauhaus
2006-10-04 12:10                   ` Dmitry A. Kazakov
replies disabled

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