Rocksolid Light

Welcome to RetroBBS

mail  files  register  newsreader  groups  login

Message-ID:  

Men of peace usually are [brave]. -- Spock, "The Savage Curtain", stardate 5906.5


devel / comp.lang.ada / Adjust primitive not called on defaulted nonlimited controlled parameter, bug or feature ?

SubjectAuthor
* Adjust primitive not called on defaulted nonlimited controlledDavid SAUVAGE
+- Re: Adjust primitive not called on defaulted nonlimited controlledJere
`* Re: Adjust primitive not called on defaulted nonlimited controlledJeffrey R.Carter
 `* Re: Adjust primitive not called on defaulted nonlimited controlled parameter, buRandy Brukardt
  `- Re: Adjust primitive not called on defaulted nonlimited controlledDavid SAUVAGE

1
Adjust primitive not called on defaulted nonlimited controlled parameter, bug or feature ?

<ee312315-c9e7-435e-a985-674f952b521cn@googlegroups.com>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=8613&group=comp.lang.ada#8613

  copy link   Newsgroups: comp.lang.ada
X-Received: by 2002:a05:620a:3c1:b0:6b8:e6e1:2950 with SMTP id r1-20020a05620a03c100b006b8e6e12950mr19965009qkm.651.1660767105614;
Wed, 17 Aug 2022 13:11:45 -0700 (PDT)
X-Received: by 2002:a81:7406:0:b0:322:64d1:3035 with SMTP id
p6-20020a817406000000b0032264d13035mr23131557ywc.279.1660767105272; Wed, 17
Aug 2022 13:11:45 -0700 (PDT)
Path: i2pn2.org!i2pn.org!usenet.blueworldhosting.com!feed1.usenet.blueworldhosting.com!peer03.iad!feed-me.highwinds-media.com!news.highwinds-media.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.ada
Date: Wed, 17 Aug 2022 13:11:45 -0700 (PDT)
Injection-Info: google-groups.googlegroups.com; posting-host=102.112.134.221; posting-account=RLLoCgoAAAAlrjFze52eMRxLw8Zw6JGC
NNTP-Posting-Host: 102.112.134.221
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <ee312315-c9e7-435e-a985-674f952b521cn@googlegroups.com>
Subject: Adjust primitive not called on defaulted nonlimited controlled
parameter, bug or feature ?
From: david.sauvage@adalabs.com (David SAUVAGE)
Injection-Date: Wed, 17 Aug 2022 20:11:45 +0000
Content-Type: text/plain; charset="UTF-8"
X-Received-Bytes: 3022
 by: David SAUVAGE - Wed, 17 Aug 2022 20:11 UTC

In the code extract below [2] Adjust primitive is not called on defaulted nonlimited controlled parameter Set.
A reproducer is available on gitlab [1]

Seems like a bug, any feedbacks ?

[1]
reproducer
https://gitlab.com/adalabs/reproducers/-/tree/main/adjust-not-called-on-defaulted-nonlimited-controlled-parameter

[2]
1 with Ada.Exceptions,
2 Ada.Text_IO;
3
4 with GNAT.OS_Lib;
5
6 procedure Reproducer.Main is
7
8 --
9 -- snippet of reproducer.ads
10 -- ...
11 -- type Translate_Set is private;
12 -- Null_Set : constant Translate_Set;
13 -- private
14 -- type Translate_Set is new Ada.Finalization.Controlled with record
15 -- Ref_Count : Integer_Access;
16 -- Set : Boolean_Access;
17 -- end record;
18 -- Null_Set : constant Translate_Set := (Ada.Finalization.Controlled with null, null);
19 -- ...
20 --
21
22 procedure Process (Set : Translate_Set := Null_Set)
23 is
24 Content : constant String := Parse (Filename => "Process",
25 Translations => Set);
26 begin
27 Ada.Text_IO.Put_Line (Content);
28 end Process;
29 begin
30 Process;
31 -- Ok, Initialize (Set) is not called because default value Null_Set is specified to Set (7.6 10/2).
32 -- However Adjust (Set) is not called (7.6 17.8/3).
33 -- Is it a feature or a bug ?
34
35 exception
36 when E : others =>
37 Ada.Text_IO.Put_Line ("(FF) Adjust was not called on the nonlimited controlled object Set, when parameter defaulted to Null_Set");
38 Ada.Text_IO.Put_Line ("(FF) " & Ada.Exceptions.Exception_Information (E));
39 GNAT.OS_Lib.OS_Exit (255);
40 end Reproducer.Main;

Re: Adjust primitive not called on defaulted nonlimited controlled parameter, bug or feature ?

<65ce4a65-c0f2-4e0b-861e-83cac4e34734n@googlegroups.com>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=8614&group=comp.lang.ada#8614

  copy link   Newsgroups: comp.lang.ada
X-Received: by 2002:a05:622a:1b01:b0:343:582f:3e07 with SMTP id bb1-20020a05622a1b0100b00343582f3e07mr404597qtb.578.1660776575138;
Wed, 17 Aug 2022 15:49:35 -0700 (PDT)
X-Received: by 2002:a25:e209:0:b0:67c:234a:f08c with SMTP id
h9-20020a25e209000000b0067c234af08cmr412393ybe.19.1660776574811; Wed, 17 Aug
2022 15:49:34 -0700 (PDT)
Path: i2pn2.org!i2pn.org!usenet.blueworldhosting.com!feed1.usenet.blueworldhosting.com!peer03.iad!feed-me.highwinds-media.com!news.highwinds-media.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.ada
Date: Wed, 17 Aug 2022 15:49:34 -0700 (PDT)
In-Reply-To: <ee312315-c9e7-435e-a985-674f952b521cn@googlegroups.com>
Injection-Info: google-groups.googlegroups.com; posting-host=96.241.104.184; posting-account=QF6XPQoAAABce2NyPxxDAaKdAkN6RgAf
NNTP-Posting-Host: 96.241.104.184
References: <ee312315-c9e7-435e-a985-674f952b521cn@googlegroups.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <65ce4a65-c0f2-4e0b-861e-83cac4e34734n@googlegroups.com>
Subject: Re: Adjust primitive not called on defaulted nonlimited controlled
parameter, bug or feature ?
From: jhb.chat@gmail.com (Jere)
Injection-Date: Wed, 17 Aug 2022 22:49:35 +0000
Content-Type: text/plain; charset="UTF-8"
X-Received-Bytes: 3263
 by: Jere - Wed, 17 Aug 2022 22:49 UTC

On Wednesday, August 17, 2022 at 4:11:46 PM UTC-4, david....@adalabs.com wrote:
> In the code extract below [2] Adjust primitive is not called on defaulted nonlimited controlled parameter Set.
> A reproducer is available on gitlab [1]
>
> Seems like a bug, any feedbacks ?
>
> [1]
> reproducer
> https://gitlab.com/adalabs/reproducers/-/tree/main/adjust-not-called-on-defaulted-nonlimited-controlled-parameter
>
> [2]
> 1 with Ada.Exceptions,
> 2 Ada.Text_IO;
> 3
> 4 with GNAT.OS_Lib;
> 5
> 6 procedure Reproducer.Main is
> 7
> 8 --
> 9 -- snippet of reproducer.ads
> 10 -- ...
> 11 -- type Translate_Set is private;
> 12 -- Null_Set : constant Translate_Set;
> 13 -- private
> 14 -- type Translate_Set is new Ada.Finalization.Controlled with record
> 15 -- Ref_Count : Integer_Access;
> 16 -- Set : Boolean_Access;
> 17 -- end record;
> 18 -- Null_Set : constant Translate_Set := (Ada.Finalization.Controlled with null, null);
> 19 -- ...
> 20 --
> 21
> 22 procedure Process (Set : Translate_Set := Null_Set)
> 23 is
> 24 Content : constant String := Parse (Filename => "Process",
> 25 Translations => Set);
> 26 begin
> 27 Ada.Text_IO.Put_Line (Content);
> 28 end Process;
> 29 begin
> 30 Process;
> 31 -- Ok, Initialize (Set) is not called because default value Null_Set is specified to Set (7.6 10/2).
> 32 -- However Adjust (Set) is not called (7.6 17.8/3).
> 33 -- Is it a feature or a bug ?
> 34
> 35 exception
> 36 when E : others =>
> 37 Ada.Text_IO.Put_Line ("(FF) Adjust was not called on the nonlimited controlled object Set, when parameter defaulted to Null_Set");
> 38 Ada.Text_IO.Put_Line ("(FF) " & Ada.Exceptions.Exception_Information (E));
> 39 GNAT.OS_Lib.OS_Exit (255);
> 40 end Reproducer.Main;

Since Translate_Set is a "by-reference type" (see section 6.2 of the RM), there isn't an
assignment actually made is my guess. The default parameter notation looks like assignment, but
I would hazard a guess that it doesn't mean an actual assignment is required.

Re: Adjust primitive not called on defaulted nonlimited controlled parameter, bug or feature ?

<tdk03o$kljt$1@dont-email.me>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=8615&group=comp.lang.ada#8615

  copy link   Newsgroups: comp.lang.ada
Path: i2pn2.org!i2pn.org!eternal-september.org!reader01.eternal-september.org!.POSTED!not-for-mail
From: spam.jrcarter.not@spam.acm.org.not (Jeffrey R.Carter)
Newsgroups: comp.lang.ada
Subject: Re: Adjust primitive not called on defaulted nonlimited controlled
parameter, bug or feature ?
Date: Thu, 18 Aug 2022 02:11:36 +0200
Organization: A noiseless patient Spider
Lines: 13
Message-ID: <tdk03o$kljt$1@dont-email.me>
References: <ee312315-c9e7-435e-a985-674f952b521cn@googlegroups.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Thu, 18 Aug 2022 00:11:36 -0000 (UTC)
Injection-Info: reader01.eternal-september.org; posting-host="14ba4c60a9f4afb66f3ba9dc8d37c000";
logging-data="677501"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+JG0H7keTF2hb8PbqR6IoRbPUTOEW/xqw="
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101
Thunderbird/91.11.0
Cancel-Lock: sha1:6HI+++4uyPwfCc1WH72EbvmFaNQ=
In-Reply-To: <ee312315-c9e7-435e-a985-674f952b521cn@googlegroups.com>
Content-Language: en-US
 by: Jeffrey R.Carter - Thu, 18 Aug 2022 00:11 UTC

On 2022-08-17 22:11, David SAUVAGE wrote:
> In the code extract below [2] Adjust primitive is not called on defaulted nonlimited controlled parameter Set.
> A reproducer is available on gitlab [1]
>
> Seems like a bug, any feedbacks ?

Adjust is called on assignment. Your code does no assignments.

--
Jeff Carter
"The time has come to act, and act fast. I'm leaving."
Blazing Saddles
36

Re: Adjust primitive not called on defaulted nonlimited controlled parameter, bug or feature ?

<tdk4a8$lkve$1@dont-email.me>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=8618&group=comp.lang.ada#8618

  copy link   Newsgroups: comp.lang.ada
Path: i2pn2.org!i2pn.org!eternal-september.org!reader01.eternal-september.org!.POSTED!not-for-mail
From: randy@rrsoftware.com (Randy Brukardt)
Newsgroups: comp.lang.ada
Subject: Re: Adjust primitive not called on defaulted nonlimited controlled parameter, bug or feature ?
Date: Wed, 17 Aug 2022 20:23:18 -0500
Organization: A noiseless patient Spider
Lines: 33
Message-ID: <tdk4a8$lkve$1@dont-email.me>
References: <ee312315-c9e7-435e-a985-674f952b521cn@googlegroups.com> <tdk03o$kljt$1@dont-email.me>
Injection-Date: Thu, 18 Aug 2022 01:23:20 -0000 (UTC)
Injection-Info: reader01.eternal-september.org; posting-host="2622ec0c9258f639e76de0fc1eae5c69";
logging-data="709614"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/crHkvEhveZGYeAuTsBwCRXm4fdxkB1GQ="
Cancel-Lock: sha1:knEs6RlfZuyQvvgcJurBwlm1nLw=
X-Priority: 3
X-Newsreader: Microsoft Outlook Express 6.00.2900.5931
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.7246
X-RFC2646: Format=Flowed; Response
X-MSMail-Priority: Normal
 by: Randy Brukardt - Thu, 18 Aug 2022 01:23 UTC

"Jeffrey R.Carter" <spam.jrcarter.not@spam.acm.org.not> wrote in message
news:tdk03o$kljt$1@dont-email.me...
> On 2022-08-17 22:11, David SAUVAGE wrote:
>> In the code extract below [2] Adjust primitive is not called on defaulted
>> nonlimited controlled parameter Set.
>> A reproducer is available on gitlab [1]
>>
>> Seems like a bug, any feedbacks ?
>
> Adjust is called on assignment. Your code does no assignments.

Right. A default parameter that is an object (as in this case) is simply
passed to the subprogram, so there is no assignment when that happens, and
thus no Adjust. If the default had been an aggregate or some more complex
expression, then there would have been a new, temporary object. But new
objects can be built-in-place, and if so, there is no assignment and no
adjust (of the whole object, individual components are assigned).
Build-in-place is required in some contexts, and since compilers have to
implement it for those contexts, and it is cheaper in most contexts, it is
likely to be used on almost all new objects (especially temporaries).

It is tricky to determine precisely when non-limited controlled objects are
Adjusted; the main rule of thumb is that any object that is Initialized or
Adjusted will be Finalized, but one should not count on any particular
number or order of Adjusts or Initializes.

Anyway, the point is that one should never expect an Adjust to be associated
with parameter passing; it could be in a few cases, but even then it could
be omitted with different compiler settings (or a different compiler).

Randy.

Re: Adjust primitive not called on defaulted nonlimited controlled parameter, bug or feature ?

<7d1abe5c-4d52-4966-9c1b-a3ecc5837b41n@googlegroups.com>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=8619&group=comp.lang.ada#8619

  copy link   Newsgroups: comp.lang.ada
X-Received: by 2002:ac8:6b18:0:b0:343:6b3:60ff with SMTP id w24-20020ac86b18000000b0034306b360ffmr1173161qts.176.1660795469717;
Wed, 17 Aug 2022 21:04:29 -0700 (PDT)
X-Received: by 2002:a81:138e:0:b0:333:5acd:9557 with SMTP id
136-20020a81138e000000b003335acd9557mr1132252ywt.509.1660795469475; Wed, 17
Aug 2022 21:04:29 -0700 (PDT)
Path: i2pn2.org!i2pn.org!usenet.blueworldhosting.com!feed1.usenet.blueworldhosting.com!peer03.iad!feed-me.highwinds-media.com!news.highwinds-media.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.ada
Date: Wed, 17 Aug 2022 21:04:29 -0700 (PDT)
In-Reply-To: <tdk4a8$lkve$1@dont-email.me>
Injection-Info: google-groups.googlegroups.com; posting-host=102.112.134.221; posting-account=RLLoCgoAAAAlrjFze52eMRxLw8Zw6JGC
NNTP-Posting-Host: 102.112.134.221
References: <ee312315-c9e7-435e-a985-674f952b521cn@googlegroups.com>
<tdk03o$kljt$1@dont-email.me> <tdk4a8$lkve$1@dont-email.me>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <7d1abe5c-4d52-4966-9c1b-a3ecc5837b41n@googlegroups.com>
Subject: Re: Adjust primitive not called on defaulted nonlimited controlled
parameter, bug or feature ?
From: david.sauvage@adalabs.com (David SAUVAGE)
Injection-Date: Thu, 18 Aug 2022 04:04:29 +0000
Content-Type: text/plain; charset="UTF-8"
X-Received-Bytes: 1684
 by: David SAUVAGE - Thu, 18 Aug 2022 04:04 UTC

> Adjust is called on assignment. Your code does no assignments.
> Right. A default parameter that is an object (as in this case) is simply
> passed to the subprogram, so there is no assignment when that happens, and
> thus no Adjust.

Thanks Jere, Jeffrey and Randy.

reproducer updated accordingly
https://gitlab.com/adalabs/reproducers/-/raw/main/adjust-not-called-on-defaulted-nonlimited-controlled-parameter/sources/reproducer-main.adb


devel / comp.lang.ada / Adjust primitive not called on defaulted nonlimited controlled parameter, bug or feature ?

1
server_pubkey.txt

rocksolid light 0.9.81
clearnet tor