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
 
Brooks Moses  
View profile  
 More options Apr 8 2007, 9:02 pm
Newsgroups: comp.lang.fortran
From: Brooks Moses <bmoses-nos...@cits1.stanford.edu>
Date: Sun, 08 Apr 2007 18:02:08 -0700
Local: Sun, Apr 8 2007 9:02 pm
Subject: Transfer and variables that don't use all their storage space.
Hello, all!

I'm working on implementing compile-time handling of the transfer
intrinsic for GFortran, and have a couple of edge-case questions about
the standard that I'm hoping someone here can comment on.

The Fortran 2003 standard states that TRANSFER(TRANSFER(E,D),E) should
result in E, if D and E are scalar variables and the physical
representation of D is as long as or longer than that of E.  (Section
13.7.121, lines 30-32.)

Now, consider a processor which supports 4-byte LOGICAL and INTEGER
variables, and suppose that D is a LOGICAL and E is an INTEGER.
Further, suppose that the canonical representations of 4-byte logicals
in this processor are to flip the 1-bit to either 1 or 0, and leave the
rest zero.

A naive reading of the double-transfer requirement would claim that, if
E is some number other than 1 or 0, then the processor is required to
feed that into D's storage space and leave it there, so that it can then
be converted back into the same number by the outer transfer statement.
  In particular, according to this reading, the inner transfer statement
cannot "normalize" the bit representation into one of the canonical
LOGICAL forms, because then the outer transfer statement would return
either 1 or 0, neither of which is equal to E.

I would contend that this reading is incorrect -- that, in particular,
if E has a bit representation that is not one of the canonical bit
representations for a logical variable, then the inner transfer
statement is illegal according to the comments in the beginning of
section 13.7 which state that a program is not allowed to invoke an
intrinsic with arguments that produce out-of-range results.  And further
that the double-transfer identity requirement obviously is only meant to
apply when both transfer calls, taken independently, are legal.

Is that a reasonable contention?

Further, a strictly literal reading of the beginning of section 13.7
would suggest that when transferring a value to a real number, NaN
should be returned if the bit representation is not a legal real number.
  In particular, this might apply for 80-bit real numbers that are
stored in 12 bytes, if the extraneous 12 bytes are non-zero (or whatever
their "usual" state is).  I'm hoping that this is reading things
excessively finely, but I suppose I should ask rather than assuming such.

- Brooks

--
The "bmoses-nospam" address is valid; no unmunging needed.


 
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.