This is the mail archive of the
fortran@gcc.gnu.org
mailing list for the GNU Fortran project.
Re: ARGH. Who wrote intrinsic_set_exponent.f90?
- From: Steve Kargl <sgk at troutmask dot apl dot washington dot edu>
- To: "DeLisle, Jerry V" <Jerry_V_DeLisle at RL dot gov>
- Cc: fortran at gcc dot gnu dot org
- Date: Mon, 28 Aug 2006 12:54:23 -0700
- Subject: Re: ARGH. Who wrote intrinsic_set_exponent.f90?
- References: <A7E4CB800B73A2409E113012513E03944CE131@EX1V.rl.gov>
On Mon, Aug 28, 2006 at 12:31:06PM -0700, DeLisle, Jerry V wrote:
> I am curious. Would this be legal, aka standard conforming?
>
> subroutine test_real4()
> real x,y
> integer i,n
> equivalence(x,i)
> x = 1.0 ! <-- Set this to some dummy value so that x is defined.
> n = 128
> i = o'00037777777' ! <-- This doesn't do what you think.
> y = set_exponent (x, n) ! <-- This is nonconforming.
> if (exponent (y) .ne. n) call abort()
> end subroutine
>
No. The assignment to i causes i to become defined and
x becomes undefined.
Read these sections.
14.7.5 Events that cause variables to become defined
14.7.6 Events that cause variables to become undefined
Variables become undefined as follows:
(1) When a variable of a given type becomes defined, all
associated variables of different type become undefined.
--
Steve