Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 1 Aug 1995 18:27:15 -0700
From:      "Steven G. Kargl" <kargl@troutmask.apl.washington.edu>
To:        FreeBSD-gnats-submit@freebsd.org
Subject:   bin/648: F77 (or f2c) format conversion bug
Message-ID:  <199508020127.SAA25513@troutmask.apl.washington.edu>
Resent-Message-ID: <199508020130.SAA20927@freefall.cdrom.com>

next in thread | raw e-mail | index | archive | help

>Number:         648
>Category:       bin
>Synopsis:       Formatted output is not converted correctly
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    freebsd-bugs
>State:          open
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Tue Aug  1 18:30:01 PDT 1995
>Last-Modified:
>Originator:     Steven G. Kargl
>Organization:
Steven G. Kargl     | Phone: 206-685-4677 |
Applied Physics Lab | Fax:   206-543-6785 |
Univ. of Washington |---------------------|
1013 NE 40th St     | FreeBSD 2.2-CURRENT |
Seattle, WA 98105   |---------------------|
>Release:        FreeBSD 2.0-BUILT-19950706 i386
>Environment:

Not sure why the Release: tag above says FreeBSD 2.0-BUILT-19950706.
I am supping the the 2.2-current branch daily with `make world' run
every Friday.

%uname -a
FreeBSD troutmask.apl.washington.edu 2.2-CURRENT FreeBSD 2.2-CURRENT
#0: Fri Jul 28 07:36:01 PDT 1995
root@troutmask.apl.washington.edu:/usr/src/sys/compile/TROUTMASK  i386



>Description:
When the following program is compiled and the resulting executable
is run, the formatted output is incorrect.  Either the f2c I/O routines
are not handling the formatted I/O correctly, or the underlying FreeBSD
C library is messed up.

      program test.f
      double precision a
      integer i
      a = 1.d97
      do 5 i = 1, 3  
         a = a * 10.d0
         write(6,10) a
         write(6,11) a
         write(6,12) a
         write(6,*) a
         print*
5     continue
10    format(E9.1)
11    format(D9.1)
12    format(G9.1)
      end

This is the output.

   .1E+99
   .1E+99
   .1E+99
  1.E+98

   .1+100     This should be .1E+100
   .1+100     This should be .1E+100
   .1+100     This should be .1E+100
  1.E+99      Correct value

   .1+101     This should be .1E+101
   .1+101     This should be .1E+101
   .1+101     This should be .1E+101
  1.E+100     Correct value


>How-To-Repeat:

%f77 -o test test.f
%test

>Fix:
	
The work-around is to avoid formatted output.  This really is not
an option with legacy F77 code.

Upgrading to the latest version of f2c might fix this problem.  I'm
in the process of upgrading my locate source tree.
>Audit-Trail:
>Unformatted:



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199508020127.SAA25513>