[3180] in Athena Bugs
Re: 6.3B RT f77
daemon@ATHENA.MIT.EDU (Ken Raeburn)
Tue Sep 12 17:18:49 1989
Date: Tue, 12 Sep 89 17:18:25 -0400
From: Ken Raeburn <raeburn@ATHENA.MIT.EDU>
To: bugs@ATHENA.MIT.EDU
Cc: Carla Jean Fermann <carla@ATHENA.MIT.EDU>,
In-Reply-To: Carla Fermann's message of Tue, 12 Sep 89 12:11:28 EDT,
I've been looking into this a little; I think it is a problem not with
fortran per se, but with the C compiler and the support routine
l_write (from /minos/source/rt/usr.lib/libI77/lwrite.c). The code
fragment:
case TYCOMPLEX:
xx= &(ptr->flreal);
y = *xx++;
z = *xx;
ERR(lwrt_C(y,z));
break;
(which handles printing of COMPLEX*8 values) does not seem to function
correctly; the compiler forgets to increment xx. Thus, any fortran
values of type COMPLEX*8 (and COMPLEX*16, through the TYDCOMPLEX case)
will probably print the imaginary component incorrectly. My test
file:
program TESTCMPLX
complex c
c = cmplx (2.7, 3.8)
print *,' cmplx(1.) = ', cmplx(1.)
print *,' c = ', c
print *,' cmplx(1.,0.) = ', cmplx(1.,0.)
end
(look familiar?) displays:
cmplx(1.) = ( 1.00000, 1.00000)
c = ( 2.70000, 2.70000)
cmplx(1.,0.) = ( 1.00000, 1.00000)
The current libI77.a was built with hc1.4r. I haven't tested it, but
I believe the code generated by hc 2.1o is correct (at least in this
respect).
As a temporary workaround, you can display the imaginary part with
imag(c) or dimag(c) for complex*8 or *16 values respectively.
This should be fixed with the spring release.
-- Ken