This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug fortran/11851] New: Write list with spaces writes bad value for last param
- From: "mac dot curl at lmco dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 7 Aug 2003 22:32:58 -0000
- Subject: [Bug fortran/11851] New: Write list with spaces writes bad value for last param
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=11851
Summary: Write list with spaces writes bad value for last param
Product: gcc
Version: 3.1
Status: UNCONFIRMED
Severity: normal
Priority: P2
Component: fortran
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: mac dot curl at lmco dot com
CC: gcc-bugs at gcc dot gnu dot org
Environment
------------------
blackjack{curlm}72: gcc -v
Reading specs from /usr/local/lib/gcc-lib/sparc-sun-solaris2.7/3.1/specs
Configured with: ../configure --with-as=/usr/ccs/bin/as --with-
ld=/usr/ccs/bin/ld --disable-nls
Thread model: posix
gcc version 3.1
blackjack{curlm}73: uname -a
SunOS blackjack 5.7 Generic_106541-20 sun4u sparc SUNW,Ultra-4
Compile and execute:
g77 g77test.f
a.out
-----------------------------source code------------------
PROGRAM G77TEST
*
* I have distilled a problem I encountered using g77 to compile/execute
* a fortran program
* The use of spaces in the write list causes the value of the last parameter
* to be incorrect. The use of spaces does not always result in this
* problem but in this case it does. The culprit seems to be the subtraction
* in the first parameter in the list
*
REAL*4 earthrad/6371.0/ ! mean earth radius in Km
REAL*4 rpd/0.01745329251/ ! radians/degree
REAL*4 theta,hat,miles
REAL*4 NM/6080./
REAL*4 EqRad/6378140./ !meters
REAL*4 meter2ft/3.280/ ! meters to feet conversion
REAL*4 delta/3.280/ !
earthrad = earthrad*meter2ft*1000! *cos(rpd*34.)
theta=34*rpd ! radians
hat = earthrad
miles = theta * earthrad /6080.
************************************************************************
* the following writes give different values for last param
* even tho only differences are spaces between params
************************************************************************
write (unit=*,FMT=100) 1,theta-delta,miles,hat,earthrad/6080.
write (unit=*,FMT=100) 2,theta-delta, miles, hat, earthrad/6080.
write (unit=*,FMT=100) 3,(theta-delta), miles, hat, earthrad/6080.
100 FORMAT(1x,I3,3x,F7.2,2x,7x,F7.2,2x,F12.2,2x,F12.2)
END