Rocksolid Light

Welcome to RetroBBS

mail  files  register  newsreader  groups  login

Message-ID:  

Why won't sharks eat lawyers? Professional courtesy.


devel / comp.lang.fortran / Re: Modifying a constant actual argument

SubjectAuthor
* Modifying a constant actual argumentThomas Koenig
+* Re: Modifying a constant actual argumentgah4
|+* Re: Modifying a constant actual argumentRon Shepard
||+* Re: Modifying a constant actual argumentgah4
|||`- Re: Modifying a constant actual argumentrobin vowels
||+- Re: Modifying a constant actual argumentThomas Koenig
||`- Re: Modifying a constant actual argumentSteven G. Kargl
|`- Re: Modifying a constant actual argumentrobin vowels
+* Re: Modifying a constant actual argumentRobert Corbett
|+* Re: Modifying a constant actual argumentpehache
||`* Re: Modifying a constant actual argumentThomas Koenig
|| `- Re: Modifying a constant actual argumentjfh
|`- Re: Modifying a constant actual argumentThomas Koenig
`- Re: Modifying a constant actual argumentFortranFan

1
Modifying a constant actual argument

<u8449h$65ni$1@newsreader4.netcologne.de>

  copy mid

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

  copy link   Newsgroups: comp.lang.fortran
Path: i2pn2.org!i2pn.org!weretis.net!feeder8.news.weretis.net!newsreader4.netcologne.de!news.netcologne.de!.POSTED.2001-4dd4-c42d-0-7285-c2ff-fe6c-992d.ipv6dyn.netcologne.de!not-for-mail
From: tkoenig@netcologne.de (Thomas Koenig)
Newsgroups: comp.lang.fortran
Subject: Modifying a constant actual argument
Date: Wed, 5 Jul 2023 16:04:01 -0000 (UTC)
Organization: news.netcologne.de
Distribution: world
Message-ID: <u8449h$65ni$1@newsreader4.netcologne.de>
Injection-Date: Wed, 5 Jul 2023 16:04:01 -0000 (UTC)
Injection-Info: newsreader4.netcologne.de; posting-host="2001-4dd4-c42d-0-7285-c2ff-fe6c-992d.ipv6dyn.netcologne.de:2001:4dd4:c42d:0:7285:c2ff:fe6c:992d";
logging-data="202482"; mail-complaints-to="abuse@netcologne.de"
User-Agent: slrn/1.0.3 (Linux)
 by: Thomas Koenig - Wed, 5 Jul 2023 16:04 UTC

This is from a discussion on the gfortran mailing list.

The code

program memain
implicit none
call fail((1))
contains
subroutine fail(x)
integer :: x
x = x + 1
print *,x
end subroutine fail
end program memain

certainly looks wrong because the dummy argument is associated
with an expression that is not definable.

However, we have failed to find a prohibition in the standard.
The closest we could find was in F2018, "15.5.2.4 Ordinary dummy
variables", which states "If a dummy argument has INTENT (OUT)
or INTENT (INOUT), the actual argument shall be definable."
But this does not apply, because x does not have INTENT.

Where and how is this prohibited? Or, if this is not prohibited,
is this an oversight in the standard?

Re: Modifying a constant actual argument

<a0d61802-996f-4064-9fcf-c2f3ebe13df6n@googlegroups.com>

  copy mid

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

  copy link   Newsgroups: comp.lang.fortran
X-Received: by 2002:ac8:5712:0:b0:400:82c7:415c with SMTP id 18-20020ac85712000000b0040082c7415cmr1009qtw.10.1688600207149;
Wed, 05 Jul 2023 16:36:47 -0700 (PDT)
X-Received: by 2002:a17:902:b708:b0:1b8:995b:b8fd with SMTP id
d8-20020a170902b70800b001b8995bb8fdmr385720pls.7.1688600206885; Wed, 05 Jul
2023 16:36:46 -0700 (PDT)
Path: i2pn2.org!i2pn.org!weretis.net!feeder6.news.weretis.net!newsfeed.hasname.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!peer01.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.fortran
Date: Wed, 5 Jul 2023 16:36:46 -0700 (PDT)
In-Reply-To: <u8449h$65ni$1@newsreader4.netcologne.de>
Injection-Info: google-groups.googlegroups.com; posting-host=2601:602:9700:4689:f8ff:891a:e170:83b4;
posting-account=gLDX1AkAAAA26M5HM-O3sVMAXdxK9FPA
NNTP-Posting-Host: 2601:602:9700:4689:f8ff:891a:e170:83b4
References: <u8449h$65ni$1@newsreader4.netcologne.de>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <a0d61802-996f-4064-9fcf-c2f3ebe13df6n@googlegroups.com>
Subject: Re: Modifying a constant actual argument
From: gah4@u.washington.edu (gah4)
Injection-Date: Wed, 05 Jul 2023 23:36:47 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
X-Received-Bytes: 2267
 by: gah4 - Wed, 5 Jul 2023 23:36 UTC

On Wednesday, July 5, 2023 at 9:04:06 AM UTC-7, Thomas Koenig wrote:

(snip)

> However, we have failed to find a prohibition in the standard.
> The closest we could find was in F2018, "15.5.2.4 Ordinary dummy
> variables", which states "If a dummy argument has INTENT (OUT)
> or INTENT (INOUT), the actual argument shall be definable."
> But this does not apply, because x does not have INTENT.
There is a fourth choice, which is no INTENT.

And, specifically, that is different from INOUT.

> Where and how is this prohibited? Or, if this is not prohibited,
> is this an oversight in the standard?

This has been known since the Fortran 66 days, though I don't know
where to find it in current standards. With INTENT, the compiler
can diagnose it. Without, especially for compiled separately,
they can't, and usually won't.

In some case, you can change the value of the constant.

PL/I removed this, by requiring the compiler to pass a modifiable
copy of the constant. For some reason, Fortran never did that.

Re: Modifying a constant actual argument

<fd3edf76-2d5c-40c6-81ce-7523b656ba97n@googlegroups.com>

  copy mid

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

  copy link   Newsgroups: comp.lang.fortran
X-Received: by 2002:a05:620a:24ce:b0:765:31f6:ab11 with SMTP id m14-20020a05620a24ce00b0076531f6ab11mr3413qkn.13.1688640276133;
Thu, 06 Jul 2023 03:44:36 -0700 (PDT)
X-Received: by 2002:a17:903:41c9:b0:1b7:ef3f:5ed3 with SMTP id
u9-20020a17090341c900b001b7ef3f5ed3mr1422525ple.5.1688640275640; Thu, 06 Jul
2023 03:44:35 -0700 (PDT)
Path: i2pn2.org!i2pn.org!news.1d4.us!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!peer02.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.fortran
Date: Thu, 6 Jul 2023 03:44:34 -0700 (PDT)
In-Reply-To: <u8449h$65ni$1@newsreader4.netcologne.de>
Injection-Info: google-groups.googlegroups.com; posting-host=108.74.162.237; posting-account=r3eTlQoAAAABvPStTQdpPnri4DjaXXqT
NNTP-Posting-Host: 108.74.162.237
References: <u8449h$65ni$1@newsreader4.netcologne.de>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <fd3edf76-2d5c-40c6-81ce-7523b656ba97n@googlegroups.com>
Subject: Re: Modifying a constant actual argument
From: robertpaulcorbett@gmail.com (Robert Corbett)
Injection-Date: Thu, 06 Jul 2023 10:44:36 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
X-Received-Bytes: 2381
 by: Robert Corbett - Thu, 6 Jul 2023 10:44 UTC

On Wednesday, July 5, 2023 at 9:04:06 AM UTC-7, Thomas Koenig wrote:
> This is from a discussion on the gfortran mailing list.
>
> The code
>
> program memain
> implicit none
> call fail((1))
> contains
> subroutine fail(x)
> integer :: x
> x = x + 1
> print *,x
> end subroutine fail
> end program memain
>
> certainly looks wrong because the dummy argument is associated
> with an expression that is not definable.
>
> However, we have failed to find a prohibition in the standard.
> The closest we could find was in F2018, "15.5.2.4 Ordinary dummy
> variables", which states "If a dummy argument has INTENT (OUT)
> or INTENT (INOUT), the actual argument shall be definable."
> But this does not apply, because x does not have INTENT.
>
> Where and how is this prohibited? Or, if this is not prohibited,
> is this an oversight in the standard?

The code does not conform to the Fortran 2018 standard.
The relevant parts of the standard are subclause 8.5.10
paragraph 5, subclause 9.2, and subclause 10.2.1.1.
Subclause 10.2.1.1 does not apply directly, but it links
the other two parts.

Bob Corbett

Re: Modifying a constant actual argument

<_0rkwTZD_8cE6WPKaxATgbrWZp0@jntp>

  copy mid

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

  copy link   Newsgroups: comp.lang.fortran
Path: i2pn2.org!i2pn.org!paganini.bofh.team!pasdenom.info!from-devjntp
Message-ID: <_0rkwTZD_8cE6WPKaxATgbrWZp0@jntp>
JNTP-Route: news2.nemoweb.net
JNTP-DataType: Article
Subject: Re: Modifying a constant actual argument
References: <u8449h$65ni$1@newsreader4.netcologne.de> <fd3edf76-2d5c-40c6-81ce-7523b656ba97n@googlegroups.com>
Newsgroups: comp.lang.fortran
JNTP-HashClient: k8Pm5T9tL49KI0-k_X_Jpz_3owo
JNTP-ThreadID: u8449h$65ni$1@newsreader4.netcologne.de
JNTP-Uri: http://news2.nemoweb.net/?DataID=_0rkwTZD_8cE6WPKaxATgbrWZp0@jntp
User-Agent: Nemo/0.999a
JNTP-OriginServer: news2.nemoweb.net
Date: Thu, 06 Jul 23 14:17:52 +0000
Organization: Nemoweb
JNTP-Browser: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 Firefox/102.0
Injection-Info: news2.nemoweb.net; posting-host="fd5675444fb2abe5cff243786215e1a6f7fd1bea"; logging-data="2023-07-06T14:17:52Z/8045411"; posting-account="44@news2.nemoweb.net"; mail-complaints-to="newsmaster@news2.nemoweb.net"
JNTP-ProtocolVersion: 0.21.1
JNTP-Server: PhpNemoServer/0.94.5
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
X-JNTP-JsonNewsGateway: 0.96
From: pehache.7@gmail.com (pehache)
 by: pehache - Thu, 6 Jul 2023 14:17 UTC

Le 06/07/2023 à 12:44, Robert Corbett a écrit :
> On Wednesday, July 5, 2023 at 9:04:06 AM UTC-7, Thomas Koenig wrote:
>> This is from a discussion on the gfortran mailing list.
>>
>> The code
>>
>> program memain
>> implicit none
>> call fail((1))
>> contains
>> subroutine fail(x)
>> integer :: x
>> x = x + 1
>> print *,x
>> end subroutine fail
>> end program memain
>>
>> certainly looks wrong because the dummy argument is associated
>> with an expression that is not definable.
>>
>> However, we have failed to find a prohibition in the standard.
>> The closest we could find was in F2018, "15.5.2.4 Ordinary dummy
>> variables", which states "If a dummy argument has INTENT (OUT)
>> or INTENT (INOUT), the actual argument shall be definable."
>> But this does not apply, because x does not have INTENT.
>>
>> Where and how is this prohibited? Or, if this is not prohibited,
>> is this an oversight in the standard?
>
> The code does not conform to the Fortran 2018 standard.
> The relevant parts of the standard are subclause 8.5.10
> paragraph 5, subclause 9.2, and subclause 10.2.1.1.
> Subclause 10.2.1.1 does not apply directly, but it links
> the other two parts.
>

Looks like the 8.5.10 par.5 tells it all:

"If no INTENT attribute is specified for a dummy argument, its use is
subject to the limitations of its effective argument"

Re: Modifying a constant actual argument

<349b30ae-bd81-4d50-b8e6-b7b121dad535n@googlegroups.com>

  copy mid

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

  copy link   Newsgroups: comp.lang.fortran
X-Received: by 2002:a05:620a:29c2:b0:765:9948:34e6 with SMTP id s2-20020a05620a29c200b00765994834e6mr8118qkp.14.1688695114045;
Thu, 06 Jul 2023 18:58:34 -0700 (PDT)
X-Received: by 2002:a05:6a00:148b:b0:682:a8df:e653 with SMTP id
v11-20020a056a00148b00b00682a8dfe653mr5059214pfu.6.1688695113716; Thu, 06 Jul
2023 18:58:33 -0700 (PDT)
Path: i2pn2.org!i2pn.org!usenet.blueworldhosting.com!diablo1.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.fortran
Date: Thu, 6 Jul 2023 18:58:33 -0700 (PDT)
In-Reply-To: <u8449h$65ni$1@newsreader4.netcologne.de>
Injection-Info: google-groups.googlegroups.com; posting-host=108.52.103.144; posting-account=ZZXq9AoAAAAQEcA7zKAGm0UFQh4gMBv7
NNTP-Posting-Host: 108.52.103.144
References: <u8449h$65ni$1@newsreader4.netcologne.de>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <349b30ae-bd81-4d50-b8e6-b7b121dad535n@googlegroups.com>
Subject: Re: Modifying a constant actual argument
From: parekhvs@gmail.com (FortranFan)
Injection-Date: Fri, 07 Jul 2023 01:58:34 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
X-Received-Bytes: 1632
 by: FortranFan - Fri, 7 Jul 2023 01:58 UTC

On Wednesday, July 5, 2023 at 12:04:06 PM UTC-4, Thomas Koenig wrote:

> ..
> Where and how is this prohibited? Or, if this is not prohibited,
> is this an oversight in the standard?

@Thomas Koenig,

What do you mean by "prohibited"?

There is no numbered constraint in this context that requires a conforming processor to detect and report any diagnostics here, if that is what you mean. The onus lies entirely on the writer of the program to conform.

Re: Modifying a constant actual argument

<u89f55$9mbs$1@newsreader4.netcologne.de>

  copy mid

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

  copy link   Newsgroups: comp.lang.fortran
Path: i2pn2.org!i2pn.org!weretis.net!feeder8.news.weretis.net!newsreader4.netcologne.de!news.netcologne.de!.POSTED.2001-4dd7-15fa-0-7285-c2ff-fe6c-992d.ipv6dyn.netcologne.de!not-for-mail
From: tkoenig@netcologne.de (Thomas Koenig)
Newsgroups: comp.lang.fortran
Subject: Re: Modifying a constant actual argument
Date: Fri, 7 Jul 2023 16:40:05 -0000 (UTC)
Organization: news.netcologne.de
Distribution: world
Message-ID: <u89f55$9mbs$1@newsreader4.netcologne.de>
References: <u8449h$65ni$1@newsreader4.netcologne.de>
<fd3edf76-2d5c-40c6-81ce-7523b656ba97n@googlegroups.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Injection-Date: Fri, 7 Jul 2023 16:40:05 -0000 (UTC)
Injection-Info: newsreader4.netcologne.de; posting-host="2001-4dd7-15fa-0-7285-c2ff-fe6c-992d.ipv6dyn.netcologne.de:2001:4dd7:15fa:0:7285:c2ff:fe6c:992d";
logging-data="317820"; mail-complaints-to="abuse@netcologne.de"
User-Agent: slrn/1.0.3 (Linux)
 by: Thomas Koenig - Fri, 7 Jul 2023 16:40 UTC

Robert Corbett <robertpaulcorbett@gmail.com> schrieb:
> On Wednesday, July 5, 2023 at 9:04:06 AM UTC-7, Thomas Koenig wrote:
>> This is from a discussion on the gfortran mailing list.
>>
>> The code
>>
>> program memain
>> implicit none
>> call fail((1))
>> contains
>> subroutine fail(x)
>> integer :: x
>> x = x + 1
>> print *,x
>> end subroutine fail
>> end program memain
>>
>> certainly looks wrong because the dummy argument is associated
>> with an expression that is not definable.
>>
>> However, we have failed to find a prohibition in the standard.
>> The closest we could find was in F2018, "15.5.2.4 Ordinary dummy
>> variables", which states "If a dummy argument has INTENT (OUT)
>> or INTENT (INOUT), the actual argument shall be definable."
>> But this does not apply, because x does not have INTENT.
>>
>> Where and how is this prohibited? Or, if this is not prohibited,
>> is this an oversight in the standard?
>
> The code does not conform to the Fortran 2018 standard.

Which is not surprising, I was just searching for why.

> The relevant parts of the standard are subclause 8.5.10
> paragraph 5,

That is

# If no INTENT attribute is specified for a dummy argument, its use
# is subject to the limitations of its effective argument (15.5.2)

Following that, I do not find the prohibition, because 15.5.2.4 does
not apply (as before). Looking further

>subclause 9.2,

That is the definition of a variable.

> and subclause 10.2.1.1.

The definition of an assignment.

> Subclause 10.2.1.1 does not apply directly, but it links
> the other two parts.

Hm, I'm afraid that I do not yet see the connection between those
parts you quoted. Could you maybe elaborate?

Re: Modifying a constant actual argument

<u89g90$9mbs$2@newsreader4.netcologne.de>

  copy mid

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

  copy link   Newsgroups: comp.lang.fortran
Path: i2pn2.org!i2pn.org!usenet.goja.nl.eu.org!3.eu.feeder.erje.net!feeder.erje.net!newsreader4.netcologne.de!news.netcologne.de!.POSTED.2001-4dd7-15fa-0-7285-c2ff-fe6c-992d.ipv6dyn.netcologne.de!not-for-mail
From: tkoenig@netcologne.de (Thomas Koenig)
Newsgroups: comp.lang.fortran
Subject: Re: Modifying a constant actual argument
Date: Fri, 7 Jul 2023 16:59:12 -0000 (UTC)
Organization: news.netcologne.de
Distribution: world
Message-ID: <u89g90$9mbs$2@newsreader4.netcologne.de>
References: <u8449h$65ni$1@newsreader4.netcologne.de>
<fd3edf76-2d5c-40c6-81ce-7523b656ba97n@googlegroups.com>
<_0rkwTZD_8cE6WPKaxATgbrWZp0@jntp>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Injection-Date: Fri, 7 Jul 2023 16:59:12 -0000 (UTC)
Injection-Info: newsreader4.netcologne.de; posting-host="2001-4dd7-15fa-0-7285-c2ff-fe6c-992d.ipv6dyn.netcologne.de:2001:4dd7:15fa:0:7285:c2ff:fe6c:992d";
logging-data="317820"; mail-complaints-to="abuse@netcologne.de"
User-Agent: slrn/1.0.3 (Linux)
 by: Thomas Koenig - Fri, 7 Jul 2023 16:59 UTC

pehache <pehache.7@gmail.com> schrieb:
> Le 06/07/2023 à 12:44, Robert Corbett a écrit :
>> On Wednesday, July 5, 2023 at 9:04:06 AM UTC-7, Thomas Koenig wrote:
>>> This is from a discussion on the gfortran mailing list.
>>>
>>> The code
>>>
>>> program memain
>>> implicit none
>>> call fail((1))
>>> contains
>>> subroutine fail(x)
>>> integer :: x
>>> x = x + 1
>>> print *,x
>>> end subroutine fail
>>> end program memain
>>>
>>> certainly looks wrong because the dummy argument is associated
>>> with an expression that is not definable.
>>>
>>> However, we have failed to find a prohibition in the standard.
>>> The closest we could find was in F2018, "15.5.2.4 Ordinary dummy
>>> variables", which states "If a dummy argument has INTENT (OUT)
>>> or INTENT (INOUT), the actual argument shall be definable."
>>> But this does not apply, because x does not have INTENT.
>>>
>>> Where and how is this prohibited? Or, if this is not prohibited,
>>> is this an oversight in the standard?
>>
>> The code does not conform to the Fortran 2018 standard.
>> The relevant parts of the standard are subclause 8.5.10
>> paragraph 5, subclause 9.2, and subclause 10.2.1.1.
>> Subclause 10.2.1.1 does not apply directly, but it links
>> the other two parts.
>>
>
> Looks like the 8.5.10 par.5 tells it all:
>
> "If no INTENT attribute is specified for a dummy argument, its use is
> subject to the limitations of its effective argument"

That could be it - the interpretation then would be that this is a
limitation, because the dummy argument is, in fact, not a variable
due to being associated with a constant expression?

Re: Modifying a constant actual argument

<33f59416-3c48-4e55-b12d-7288c580917fn@googlegroups.com>

  copy mid

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

  copy link   Newsgroups: comp.lang.fortran
X-Received: by 2002:a05:620a:4613:b0:767:7de5:85eb with SMTP id br19-20020a05620a461300b007677de585ebmr15553qkb.15.1688791850109;
Fri, 07 Jul 2023 21:50:50 -0700 (PDT)
X-Received: by 2002:a17:902:e809:b0:1b8:5541:9d3e with SMTP id
u9-20020a170902e80900b001b855419d3emr6953012plg.6.1688791849793; Fri, 07 Jul
2023 21:50:49 -0700 (PDT)
Path: i2pn2.org!i2pn.org!weretis.net!feeder8.news.weretis.net!proxad.net!feeder1-2.proxad.net!209.85.160.216.MISMATCH!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.fortran
Date: Fri, 7 Jul 2023 21:50:49 -0700 (PDT)
In-Reply-To: <u89g90$9mbs$2@newsreader4.netcologne.de>
Injection-Info: google-groups.googlegroups.com; posting-host=115.189.132.9; posting-account=KnYfEgoAAAD1tUJTvdAUZ3XojNa5tezZ
NNTP-Posting-Host: 115.189.132.9
References: <u8449h$65ni$1@newsreader4.netcologne.de> <fd3edf76-2d5c-40c6-81ce-7523b656ba97n@googlegroups.com>
<_0rkwTZD_8cE6WPKaxATgbrWZp0@jntp> <u89g90$9mbs$2@newsreader4.netcologne.de>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <33f59416-3c48-4e55-b12d-7288c580917fn@googlegroups.com>
Subject: Re: Modifying a constant actual argument
From: harperjf2@gmail.com (jfh)
Injection-Date: Sat, 08 Jul 2023 04:50:50 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
 by: jfh - Sat, 8 Jul 2023 04:50 UTC

On Saturday, July 8, 2023 at 4:59:15 AM UTC+12, Thomas Koenig wrote:
> pehache <peha...@gmail.com> schrieb:
> > Le 06/07/2023 à 12:44, Robert Corbett a écrit :
> >> On Wednesday, July 5, 2023 at 9:04:06 AM UTC-7, Thomas Koenig wrote:
> >>> This is from a discussion on the gfortran mailing list.
> >>>
> >>> The code
> >>>
> >>> program memain
> >>> implicit none
> >>> call fail((1))
> >>> contains
> >>> subroutine fail(x)
> >>> integer :: x
> >>> x = x + 1
> >>> print *,x
> >>> end subroutine fail
> >>> end program memain
> >>>
> >>> certainly looks wrong because the dummy argument is associated
> >>> with an expression that is not definable.
> >>>
> >>> However, we have failed to find a prohibition in the standard.
> >>> The closest we could find was in F2018, "15.5.2.4 Ordinary dummy
> >>> variables", which states "If a dummy argument has INTENT (OUT)
> >>> or INTENT (INOUT), the actual argument shall be definable."
> >>> But this does not apply, because x does not have INTENT.
> >>>
> >>> Where and how is this prohibited? Or, if this is not prohibited,
> >>> is this an oversight in the standard?
> >>
> >> The code does not conform to the Fortran 2018 standard.
> >> The relevant parts of the standard are subclause 8.5.10
> >> paragraph 5, subclause 9.2, and subclause 10.2.1.1.
> >> Subclause 10.2.1.1 does not apply directly, but it links
> >> the other two parts.
> >>
> >
> > Looks like the 8.5.10 par.5 tells it all:
> >
> > "If no INTENT attribute is specified for a dummy argument, its use is
> > subject to the limitations of its effective argument"
> That could be it - the interpretation then would be that this is a
> limitation, because the dummy argument is, in fact, not a variable
> due to being associated with a constant expression?
Indeed. And it's one of the many errors that compilers are not obliged to diagnose. In such cases compilers are free to do anything with the program, up to starting WWIII if appropriate hardware is fitted (as they used to say when f77 was the latest version.)

Re: Modifying a constant actual argument

<Ra6qM.52327$RIra.32378@fx09.iad>

  copy mid

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

  copy link   Newsgroups: comp.lang.fortran
Path: i2pn2.org!i2pn.org!weretis.net!feeder8.news.weretis.net!newsreader4.netcologne.de!news.netcologne.de!peer03.ams1!peer.ams1.xlned.com!news.xlned.com!peer02.iad!feed-me.highwinds-media.com!news.highwinds-media.com!fx09.iad.POSTED!not-for-mail
MIME-Version: 1.0
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.13; rv:102.0)
Gecko/20100101 Thunderbird/102.12.0
Subject: Re: Modifying a constant actual argument
Content-Language: en-US
Newsgroups: comp.lang.fortran
References: <u8449h$65ni$1@newsreader4.netcologne.de>
<a0d61802-996f-4064-9fcf-c2f3ebe13df6n@googlegroups.com>
From: nospam@nowhere.org (Ron Shepard)
In-Reply-To: <a0d61802-996f-4064-9fcf-c2f3ebe13df6n@googlegroups.com>
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Lines: 18
Message-ID: <Ra6qM.52327$RIra.32378@fx09.iad>
X-Complaints-To: abuse@easynews.com
Organization: Forte - www.forteinc.com
X-Complaints-Info: Please be sure to forward a copy of ALL headers otherwise we will be unable to process your complaint properly.
Date: Sat, 8 Jul 2023 00:08:01 -0500
X-Received-Bytes: 1832
 by: Ron Shepard - Sat, 8 Jul 2023 05:08 UTC

On 7/5/23 6:36 PM, gah4 wrote:
> In some case, you can change the value of the constant.

I've seen cases were the values of literal constants were changed. This
example isn't like that because the actual argument is an expression
(because of the parentheses) rather than a literal constant.

> PL/I removed this, by requiring the compiler to pass a modifiable
> copy of the constant. For some reason, Fortran never did that.

Fortran now has the VALUE attribute for dummy arguments. This does what
you are talking about, it requires the compiler to create a modifiable
copy of its actual argument. The dummy argument can be changed, while
the actual argument is never changed. I think this attribute requires an
explicit interface, since both the caller and the callee need to know
about it.

$.02 -Ron Shepard

Re: Modifying a constant actual argument

<d5a58876-14fe-4f8a-94cb-d1cfaaa3a76en@googlegroups.com>

  copy mid

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

  copy link   Newsgroups: comp.lang.fortran
X-Received: by 2002:ac8:550d:0:b0:403:a73b:893b with SMTP id j13-20020ac8550d000000b00403a73b893bmr489qtq.3.1688801016173;
Sat, 08 Jul 2023 00:23:36 -0700 (PDT)
X-Received: by 2002:ad4:590b:0:b0:635:eade:c68d with SMTP id
ez11-20020ad4590b000000b00635eadec68dmr21607qvb.8.1688801016008; Sat, 08 Jul
2023 00:23:36 -0700 (PDT)
Path: i2pn2.org!i2pn.org!news.neodome.net!feeder1.feed.usenet.farm!feed.usenet.farm!peer01.ams4!peer.am4.highwinds-media.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.fortran
Date: Sat, 8 Jul 2023 00:23:35 -0700 (PDT)
In-Reply-To: <Ra6qM.52327$RIra.32378@fx09.iad>
Injection-Info: google-groups.googlegroups.com; posting-host=2601:602:9700:4689:dcab:818f:16ea:7b90;
posting-account=gLDX1AkAAAA26M5HM-O3sVMAXdxK9FPA
NNTP-Posting-Host: 2601:602:9700:4689:dcab:818f:16ea:7b90
References: <u8449h$65ni$1@newsreader4.netcologne.de> <a0d61802-996f-4064-9fcf-c2f3ebe13df6n@googlegroups.com>
<Ra6qM.52327$RIra.32378@fx09.iad>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <d5a58876-14fe-4f8a-94cb-d1cfaaa3a76en@googlegroups.com>
Subject: Re: Modifying a constant actual argument
From: gah4@u.washington.edu (gah4)
Injection-Date: Sat, 08 Jul 2023 07:23:36 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
X-Received-Bytes: 3147
 by: gah4 - Sat, 8 Jul 2023 07:23 UTC

On Friday, July 7, 2023 at 10:08:06 PM UTC-7, Ron Shepard wrote:
> On 7/5/23 6:36 PM, gah4 wrote:
> > In some case, you can change the value of the constant.

> I've seen cases were the values of literal constants were changed. This
> example isn't like that because the actual argument is an expression
> (because of the parentheses) rather than a literal constant.

As well as I know it, from when this question was asked years ago,
that doesn't get out of the problem. You are not supposed to modify
expression arguments, and so the compiler can pass the address
(usually) of a constant.

> > PL/I removed this, by requiring the compiler to pass a modifiable
> > copy of the constant. For some reason, Fortran never did that.

And PL/I specifically allows for constant in parentheses as
a modifiable temporary.

> Fortran now has the VALUE attribute for dummy arguments. This does what
> you are talking about, it requires the compiler to create a modifiable
> copy of its actual argument. The dummy argument can be changed, while
> the actual argument is never changed. I think this attribute requires an
> explicit interface, since both the caller and the callee need to know
> about it.
Yes. Well, that is also needed to make C interoperability work, in the
cases where the caller is C. But also, yes, it has to work when both
are Fortran.

But it would be so convenient for users, and not all that hard,
to supply modifiable temporaries for expressions and constants.

Note that in PL/I you can put a variable in parentheses and
get the modifiable temporary. As above, since Fortran doesn't
allow modifying expressions, it doesn't have to supply a
temporary at all, even for a variable.

Re: Modifying a constant actual argument

<u8b4bf$aoon$1@newsreader4.netcologne.de>

  copy mid

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

  copy link   Newsgroups: comp.lang.fortran
Path: i2pn2.org!i2pn.org!weretis.net!feeder8.news.weretis.net!newsreader4.netcologne.de!news.netcologne.de!.POSTED.2001-4dd7-15fa-0-7285-c2ff-fe6c-992d.ipv6dyn.netcologne.de!not-for-mail
From: tkoenig@netcologne.de (Thomas Koenig)
Newsgroups: comp.lang.fortran
Subject: Re: Modifying a constant actual argument
Date: Sat, 8 Jul 2023 07:47:59 -0000 (UTC)
Organization: news.netcologne.de
Distribution: world
Message-ID: <u8b4bf$aoon$1@newsreader4.netcologne.de>
References: <u8449h$65ni$1@newsreader4.netcologne.de>
<a0d61802-996f-4064-9fcf-c2f3ebe13df6n@googlegroups.com>
<Ra6qM.52327$RIra.32378@fx09.iad>
Injection-Date: Sat, 8 Jul 2023 07:47:59 -0000 (UTC)
Injection-Info: newsreader4.netcologne.de; posting-host="2001-4dd7-15fa-0-7285-c2ff-fe6c-992d.ipv6dyn.netcologne.de:2001:4dd7:15fa:0:7285:c2ff:fe6c:992d";
logging-data="353047"; mail-complaints-to="abuse@netcologne.de"
User-Agent: slrn/1.0.3 (Linux)
 by: Thomas Koenig - Sat, 8 Jul 2023 07:47 UTC

Ron Shepard <nospam@nowhere.org> schrieb:
> On 7/5/23 6:36 PM, gah4 wrote:
>> In some case, you can change the value of the constant.
>
> I've seen cases were the values of literal constants were changed.

Ah yes, the famous "variation of constants".

This was an artefact of the calling conventions on IBM mainframes.
For

call foo(3.14159265)
print *,3.14159265

they passed a pointer to a constant 42 to foo, and since they didn't
want to waste space, the constant was there only once. And they usually
put the constants on the same pages as the executable code, so this
"worked". I guess it could come handy if the value of pi changed during
execution of the program.

These days, the constant is likely to be in read-only memory, so there
will be an access violation if anybody tries stuff like that.

>This
> example isn't like that because the actual argument is an expression
> (because of the parentheses) rather than a literal constant.

It would still be likely be implemented the same way, but it's been
a few decades since I last had access to VS Fortran :-)

Re: Modifying a constant actual argument

<u8buf2$1p8vh$1@dont-email.me>

  copy mid

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

  copy link   Newsgroups: comp.lang.fortran
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: sgk@REMOVEtroutmask.apl.washington.edu (Steven G. Kargl)
Newsgroups: comp.lang.fortran
Subject: Re: Modifying a constant actual argument
Date: Sat, 8 Jul 2023 15:13:38 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 36
Message-ID: <u8buf2$1p8vh$1@dont-email.me>
References: <u8449h$65ni$1@newsreader4.netcologne.de>
<a0d61802-996f-4064-9fcf-c2f3ebe13df6n@googlegroups.com>
<Ra6qM.52327$RIra.32378@fx09.iad>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Injection-Date: Sat, 8 Jul 2023 15:13:38 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="64219cd1ba3d384e92fb228354f7505d";
logging-data="1876977"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/ohHzCF3X2vd1+sgfDAIT+"
User-Agent: Pan/0.145 (Duplicitous mercenary valetism; d7e168a
git.gnome.org/pan2)
Cancel-Lock: sha1:lUAwQgZ45X5fxG4W1DMqwS+04rM=
 by: Steven G. Kargl - Sat, 8 Jul 2023 15:13 UTC

On Sat, 08 Jul 2023 00:08:01 -0500, Ron Shepard wrote:

> On 7/5/23 6:36 PM, gah4 wrote:
>> In some case, you can change the value of the constant.
>
> I've seen cases were the values of literal constants were changed. This
> example isn't like that because the actual argument is an expression
> (because of the parentheses) rather than a literal constant.

The only place the Fortran standard mentions this issue is
in a note, which is non-normative.

F2023 (23-007r1.pdf), p. 114-115, Note 4, last paragraph.
INTENT (INOUT) is not equivalent to omitting the INTENT attribute. The
actual argument corresponding to an INTENT (INOUT) dummy argument is
always required to be definable, while an actual argument corresponding
to a dummy argument without an INTENT attribute need be definable only
if the dummy argument is actually redefined.

You'll find in the discussion of "effective argument" a statement that once
argument association is established, an actual argument can only be referenced
through the effective argument. This would mean that the following is
doubly non-conforming

program foo
call bar((1))
end program foo

subroutine bar(x)
x = 42 + (1)
end

--
steve

Re: Modifying a constant actual argument

<18b5c7ab-0143-404e-acdd-ebb1c76311d0n@googlegroups.com>

  copy mid

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

  copy link   Newsgroups: comp.lang.fortran
X-Received: by 2002:a05:620a:1a8f:b0:767:f1fc:5297 with SMTP id bl15-20020a05620a1a8f00b00767f1fc5297mr1154qkb.15.1689222133547;
Wed, 12 Jul 2023 21:22:13 -0700 (PDT)
X-Received: by 2002:a05:6808:2024:b0:3a3:6881:242 with SMTP id
q36-20020a056808202400b003a368810242mr628347oiw.11.1689222133160; Wed, 12 Jul
2023 21:22:13 -0700 (PDT)
Path: i2pn2.org!i2pn.org!weretis.net!feeder8.news.weretis.net!proxad.net!feeder1-2.proxad.net!209.85.160.216.MISMATCH!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.fortran
Date: Wed, 12 Jul 2023 21:22:12 -0700 (PDT)
In-Reply-To: <a0d61802-996f-4064-9fcf-c2f3ebe13df6n@googlegroups.com>
Injection-Info: google-groups.googlegroups.com; posting-host=49.185.177.87; posting-account=L5wwzgoAAAAfQcZzW8eLJKqyFogVIeWA
NNTP-Posting-Host: 49.185.177.87
References: <u8449h$65ni$1@newsreader4.netcologne.de> <a0d61802-996f-4064-9fcf-c2f3ebe13df6n@googlegroups.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <18b5c7ab-0143-404e-acdd-ebb1c76311d0n@googlegroups.com>
Subject: Re: Modifying a constant actual argument
From: robin51@dodo.com.au (robin vowels)
Injection-Date: Thu, 13 Jul 2023 04:22:13 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
 by: robin vowels - Thu, 13 Jul 2023 04:22 UTC

On Thursday, 6 July 2023 at 09:36:48 UTC+10, gah4 wrote:
> On Wednesday, July 5, 2023 at 9:04:06 AM UTC-7, Thomas Koenig wrote:
>
> (snip)
> > However, we have failed to find a prohibition in the standard.
> > The closest we could find was in F2018, "15.5.2.4 Ordinary dummy
> > variables", which states "If a dummy argument has INTENT (OUT)
> > or INTENT (INOUT), the actual argument shall be definable."
> > But this does not apply, because x does not have INTENT.
> There is a fourth choice, which is no INTENT.
>
> And, specifically, that is different from INOUT.
> > Where and how is this prohibited? Or, if this is not prohibited,
> > is this an oversight in the standard?
..
> This has been known since the Fortran 66 days,
..
and well before that.
Which is why PL/I did not fall into that trap.
..
> though I don't know
> where to find it in current standards. With INTENT, the compiler
> can diagnose it. Without, especially for compiled separately,
> they can't, and usually won't.
>
> In some case, you can change the value of the constant.
>
> PL/I removed this, by requiring the compiler to pass a modifiable
> copy of the constant. For some reason, Fortran never did that.
..
In the case of a constant, PL/I generates a temporary in which the value is placed,
and passes the address of the temporary.

Re: Modifying a constant actual argument

<f04f4803-fa8b-4fd7-bdc9-04e5fe2acb90n@googlegroups.com>

  copy mid

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

  copy link   Newsgroups: comp.lang.fortran
X-Received: by 2002:ac8:590c:0:b0:403:cecf:8c12 with SMTP id 12-20020ac8590c000000b00403cecf8c12mr1694qty.5.1689222352284;
Wed, 12 Jul 2023 21:25:52 -0700 (PDT)
X-Received: by 2002:a05:6808:23c1:b0:3a3:a704:6e40 with SMTP id
bq1-20020a05680823c100b003a3a7046e40mr642017oib.3.1689222352039; Wed, 12 Jul
2023 21:25:52 -0700 (PDT)
Path: i2pn2.org!i2pn.org!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!peer01.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.fortran
Date: Wed, 12 Jul 2023 21:25:51 -0700 (PDT)
In-Reply-To: <d5a58876-14fe-4f8a-94cb-d1cfaaa3a76en@googlegroups.com>
Injection-Info: google-groups.googlegroups.com; posting-host=49.185.177.87; posting-account=L5wwzgoAAAAfQcZzW8eLJKqyFogVIeWA
NNTP-Posting-Host: 49.185.177.87
References: <u8449h$65ni$1@newsreader4.netcologne.de> <a0d61802-996f-4064-9fcf-c2f3ebe13df6n@googlegroups.com>
<Ra6qM.52327$RIra.32378@fx09.iad> <d5a58876-14fe-4f8a-94cb-d1cfaaa3a76en@googlegroups.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <f04f4803-fa8b-4fd7-bdc9-04e5fe2acb90n@googlegroups.com>
Subject: Re: Modifying a constant actual argument
From: robin51@dodo.com.au (robin vowels)
Injection-Date: Thu, 13 Jul 2023 04:25:52 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
X-Received-Bytes: 3410
 by: robin vowels - Thu, 13 Jul 2023 04:25 UTC

On Saturday, 8 July 2023 at 17:23:38 UTC+10, gah4 wrote:
> On Friday, July 7, 2023 at 10:08:06 PM UTC-7, Ron Shepard wrote:
> > On 7/5/23 6:36 PM, gah4 wrote:
> > > In some case, you can change the value of the constant.
>
> > I've seen cases were the values of literal constants were changed. This
> > example isn't like that because the actual argument is an expression
> > (because of the parentheses) rather than a literal constant.
> As well as I know it, from when this question was asked years ago,
> that doesn't get out of the problem. You are not supposed to modify
> expression arguments, and so the compiler can pass the address
> (usually) of a constant.
> > > PL/I removed this, by requiring the compiler to pass a modifiable
> > > copy of the constant. For some reason, Fortran never did that.
> And PL/I specifically allows for constant in parentheses as
> a modifiable temporary.
..
I think that you mean a variable in parenthesls.
Constants as arguments always have a temporary generated,
and do not need to be in parentheses.
..
> > Fortran now has the VALUE attribute for dummy arguments. This does what
> > you are talking about, it requires the compiler to create a modifiable
> > copy of its actual argument. The dummy argument can be changed, while
> > the actual argument is never changed. I think this attribute requires an
> > explicit interface, since both the caller and the callee need to know
> > about it.
> Yes. Well, that is also needed to make C interoperability work, in the
> cases where the caller is C. But also, yes, it has to work when both
> are Fortran.
>
> But it would be so convenient for users, and not all that hard,
> to supply modifiable temporaries for expressions and constants.
>
> Note that in PL/I you can put a variable in parentheses and
> get the modifiable temporary. As above, since Fortran doesn't
> allow modifying expressions, it doesn't have to supply a
> temporary at all, even for a variable.

1
server_pubkey.txt

rocksolid light 0.9.81
clearnet tor