From: DrPi <314@drpi.fr>
Subject: Re: Record initialisation question
Date: Sat, 16 Jan 2021 11:28:36 +0100 [thread overview]
Message-ID: <6002bfd5$0$6202$426a74cc@news.free.fr> (raw)
In-Reply-To: <9f669e87-b60d-4a9c-8aa9-51aa4042533an@googlegroups.com>
Le 15/01/2021 à 19:15, Shark8 a écrit :
> On Friday, January 15, 2021 at 12:50:41 AM UTC-7, DrPi wrote:
>> Unchecked_Conversion is not compatible with no elaboration code.
> I find that surprising.
> Ada.Unchecked_Conversion is defined by the LRM as a compiler-intrinsic, with the Pure pragma*:
>
> generic
> type Source(<>) is limited private;
> type Target(<>) is limited private;
> function Ada.Unchecked_Conversion(S : Source) return Target
> with Convention => Intrinsic;
> pragma Pure(Ada.Unchecked_Conversion);
>
> The GNAT source has, as its last three lines:
> pragma No_Elaboration_Code_All (Ada.Unchecked_Conversion);
> pragma Pure (Ada.Unchecked_Conversion);
> pragma Import (Intrinsic, Ada.Unchecked_Conversion);
>
> So, if you are generating elaboration-code, then GNAT is broken.
>
> * IIUC, this (Intrinsic+Pure) should make it essentially equivalent to C's bitwise reinterpretation-cast, and [IIRC] should qualify for 'static function call'.
>
I made new tests.
You are right, Unchecked_Conversion() is not the culprit.
When I tried it, I got 'violation of restriction "No_Elaboration_Code"'
due to other statements but didn't realized it.
next prev parent reply other threads:[~2021-01-16 10:28 UTC|newest]
Thread overview: 32+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-01-09 9:30 Record initialisation question DrPi
2021-01-09 10:46 ` Dmitry A. Kazakov
2021-01-10 16:41 ` DrPi
2021-01-11 21:48 ` Shark8
2021-01-12 11:38 ` Simon Wright
2021-01-12 15:01 ` Shark8
2021-01-14 21:32 ` Simon Wright
2021-01-14 23:12 ` Shark8
2021-01-14 12:58 ` DrPi
2021-01-17 17:03 ` DrPi
2021-01-17 23:55 ` Shark8
2021-01-18 20:02 ` DrPi
2021-01-19 5:50 ` Randy Brukardt
2021-01-09 15:44 ` Niklas Holsti
2021-01-10 16:53 ` DrPi
2021-01-10 19:30 ` Niklas Holsti
2021-01-10 21:27 ` DrPi
2021-01-10 22:14 ` Niklas Holsti
2021-01-11 17:46 ` DrPi
2021-01-11 20:58 ` Niklas Holsti
2021-01-14 13:07 ` DrPi
2021-01-14 13:36 ` AdaMagica
2021-01-14 14:07 ` Jeffrey R. Carter
2021-01-14 14:09 ` Jeffrey R. Carter
2021-01-14 14:27 ` Niklas Holsti
2021-01-14 16:53 ` Shark8
2021-01-15 7:50 ` DrPi
2021-01-15 18:15 ` Shark8
2021-01-16 10:28 ` DrPi [this message]
2021-01-14 16:59 ` Paul Rubin
2021-01-15 7:49 ` DrPi
2021-01-17 17:08 ` DrPi
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox