From: "Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de>
Subject: Re: ANN: GCC 11.1.0 for macOS
Date: Tue, 4 May 2021 22:12:42 +0200 [thread overview]
Message-ID: <s6s9rm$1clb$1@gioia.aioe.org> (raw)
In-Reply-To: 86v97yie5y.fsf@stephe-leake.org
On 2021-05-04 19:47, Stephen Leake wrote:
> "Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de> writes:
>
>> As a side note. The version 11 brings new incompatibilities breaking
>> old code. In some cases X'Access is no more accepted and need to be
>> replaced by X'Unchecked_Access.
>>
>> I am to lazy to analyze whether that it is a bug of feature, just be aware.
>>
>> I dare say that every Ada style guideline should require
>> 'Unchecked_Access everywhere. The issue became a permanent maintenance
>> nightmare.
>
> I had a similar issue upgrading from GNAT Community 2020 to GNAT Pro 21.
> The GNAT compiler has gotten smarter about enforcing accessibility
> rules.
Alas.
> Since those rules are there to prevent dangling references, they should
> be respected; I fixed my code to compile with 'Access.
For example:
declare
Location : Abstract_Layer'Class renames
Abstract_Layer'Class (Under.all);
begin
...
if Location'Access = Location.Widget.Bottom then
This does not compile anymore. Clearly there cannot be any dangling
references here.
Recent changes broke a lot of code involving comparisons of access
types, especially if an anonymous access type is involved. Among them
are cases when even 'Unchecked_Access does not help. So, one should
resort to awful 'Address instead.
The situation is quite dire. I would even suggest introducing a built-in
operation to compare an object with an access, e.g.
P'Refers (X) -- True if P points to X
since comparison of access types became too volatile.
> It is a pain that GNAT didn't get this totally correct the first time
> around, but that's life.
I am not a language lawyer to judge. My impression that in practice
accessibility rules significantly reduce safety and code quality rather
than add it.
--
Regards,
Dmitry A. Kazakov
http://www.dmitry-kazakov.de
next prev parent reply other threads:[~2021-05-04 20:12 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-05-02 16:28 ANN: GCC 11.1.0 for macOS Simon Wright
2021-05-02 16:54 ` Dmitry A. Kazakov
2021-05-04 17:47 ` Stephen Leake
2021-05-04 20:12 ` Dmitry A. Kazakov [this message]
2021-05-03 8:29 ` J-P. Rosen
2021-05-03 10:46 ` Luke A. Guest
2021-05-03 11:50 ` J-P. Rosen
2021-05-03 11:14 ` Simon Wright
2021-05-03 15:16 ` Bill Findlay
2021-05-03 15:44 ` Simon Wright
2021-05-04 15:20 ` Simon Wright
2021-05-23 7:32 ` Blady
2021-06-10 16:21 ` Simon Wright
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox