Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
Message from discussion Transfer and variables that don't use all their storage space.
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Richard Maine  
View profile  
 More options Apr 9 2007, 12:57 pm
Newsgroups: comp.lang.fortran
From: nos...@see.signature (Richard Maine)
Date: Mon, 9 Apr 2007 09:57:06 -0700
Local: Mon, Apr 9 2007 12:57 pm
Subject: Re: Transfer and variables that don't use all their storage space.

James Giles <jamesgi...@worldnet.att.net> wrote:
> Richard Maine wrote:
> > That sentence
> > specifically says what some cases give as a result, and it says it in
> > a fashion that is not system dependent.
> Well, I've thought it over again and I can't see any difference
> between passing transfer(transfer(E,D),E)) as an actual argument
> and just passing E as the actual argument except the following:
> the result of TRANSFER may not be argument associated
> with a dummy argument that has OUT among its INTENTs.
> I don't see how that difference could cause "havoc".  So, at
> least as far as the issue of ALLOCATABLE components,
> I still see no problems.

I need to use a temp variable to get the effect. First, I claim that
introducing an intermediate variable cannot change the standard's claim
that transfer((transfer(e,d),e) must return E.  If that made a
difference, then that would mean that the result of transfer was somehow
not captured in its value. In particular, if we change it to

  d = transfer(e,d)
  now use transfer(d,e)

This is for a case where D is of a "benign" type where the assignment
operator doesn't do anything "odd".

So do

  d = transfer(e,d)
  call sub(transfer(d,ee),e)

where ee is another vairiable of the same type as e. I probably don't
even need it, but I use it to remove any question that the first
argument might have any reference to e. Now in the subroutine

  subroutine sub(ee,e)
  ...

I can imagine a fair chance that the allocatable components of e and ee
have managed to get "associated". Well, not as defined by the standard
because it doesn't have any concept like that for allocatables. But if
you change the value of the allocatable component of e, that's likely to
also change the value of the component of ee. Deallocating e could have
other more "interesting" results such as the component of e pointing to
storage that is used for some random other thing. I don't see that this
code violates any of the rules of the standard. In particular, the
actual arguments aren't associated in any way acknowledged by the
standard, so the prohibitions against changing the values of the dummies
don't apply. You can't directly change the value of the first dummy
because its actual is an expression, but you can change the value of the
second.

That's just a pretty much off-the-top-of-my head example. It is slightly
indirect because I did keep running into bars (some of the same ones you
mentioned), but I methodically worked around each one.

Once you have a single "hole" like this, you can open up many others.

> For
> all we know, someone in the F90 committee carefully thought
> through all possible cases and found no "havoc" arising from
> any of them.

You have *GOT* to be kidding. :-) Yes, I saw that you labelled it as
speculation. But I don't even think it is very plausible speculation.
I've seentoo much of the committee close up; I don't think they would
have thought through all the cases of that one, particularly as...

> That's speculation too (unless someone remembers
> it).  It seems as likely as that there *is* a problem with the
> requirement that no one can identify after all these years.

"All these years" isn't very many for allocatable components, which are
where I can most readily see a related problem. Wouldn't surprise me if
there are others, but that's one I think I can see concretely. There's
no way that whoever wrote the transfer description for f90 could have
carefully considered how it worked with allocatable components, the
details of which weren't done til a decade later. I was there during all
of the work on allocatable components, and I don't recall any such topic
relating to transfer ever having been broached. I do recall that
allocatable components had lots and lots of subtleties that took a long
time to work out, both in the standard and in implementations. They seem
like such a simple and "obvious" thing that many people don't see why
they took so long. There was a time when I didn't appreciate the issues.
My first attempts at f90 code, before I had a compiler to check me, used
allocatable components because I just assumed that, of course, you could
do that since you had allocatables and you had components.

--
Richard Maine                    | Good judgement comes from experience;
email: last name at domain . net | experience comes from bad judgement.
domain: summertriangle           |  -- Mark Twain


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.