public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/11851] New: Write list with spaces writes bad value for last param
@ 2003-08-07 22:32 mac dot curl at lmco dot com
  2003-08-08 10:31 ` [Bug fortran/11851] " bdavis9659 at comcast dot net
  2003-08-08 10:36 ` toon at gcc dot gnu dot org
  0 siblings, 2 replies; 3+ messages in thread
From: mac dot curl at lmco dot com @ 2003-08-07 22:32 UTC (permalink / raw)
  To: gcc-bugs

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


^ permalink raw reply	[flat|nested] 3+ messages in thread

* [Bug fortran/11851] Write list with spaces writes bad value for last param
  2003-08-07 22:32 [Bug fortran/11851] New: Write list with spaces writes bad value for last param mac dot curl at lmco dot com
@ 2003-08-08 10:31 ` bdavis9659 at comcast dot net
  2003-08-08 10:36 ` toon at gcc dot gnu dot org
  1 sibling, 0 replies; 3+ messages in thread
From: bdavis9659 at comcast dot net @ 2003-08-08 10:31 UTC (permalink / raw)
  To: gcc-bugs

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



------- Additional Comments From bdavis9659 at comcast dot net  2003-08-08 10:31 -------
Your code exceeds the 72 column limit for standard fortran.  Anything after
column 72 is ignored:

            write (unit=*,FMT=100) 1,theta-delta,miles,hat,earthrad/6080 
            write (unit=*,FMT=100) 2,theta-delta, miles, hat, earthrad/6 
            write (unit=*,FMT=100) 3,(theta-delta), miles, hat, earthrad

This is how it should look:

            write (unit=*,FMT=100) 1,theta-delta,miles,hat,earthrad/6080
     1       .
            write (unit=*,FMT=100) 2,theta-delta, miles, hat, earthrad/
     1       6080.
            write (unit=*,FMT=100) 3,(theta-delta), miles, hat,
     1       earthrad/6080.

Any character in column 6 means "continuation".  Alternatively, use the compile
option " -ffixed-line-length-0 ", which allows code to exceed column 72.


^ permalink raw reply	[flat|nested] 3+ messages in thread

* [Bug fortran/11851] Write list with spaces writes bad value for last param
  2003-08-07 22:32 [Bug fortran/11851] New: Write list with spaces writes bad value for last param mac dot curl at lmco dot com
  2003-08-08 10:31 ` [Bug fortran/11851] " bdavis9659 at comcast dot net
@ 2003-08-08 10:36 ` toon at gcc dot gnu dot org
  1 sibling, 0 replies; 3+ messages in thread
From: toon at gcc dot gnu dot org @ 2003-08-08 10:36 UTC (permalink / raw)
  To: gcc-bugs

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


toon at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|                            |INVALID


------- Additional Comments From toon at gcc dot gnu dot org  2003-08-08 10:36 -------
See comments by Bud Davis.

Regards,

Toon Moene.


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2003-08-08 10:36 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-08-07 22:32 [Bug fortran/11851] New: Write list with spaces writes bad value for last param mac dot curl at lmco dot com
2003-08-08 10:31 ` [Bug fortran/11851] " bdavis9659 at comcast dot net
2003-08-08 10:36 ` toon at gcc dot gnu dot org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).