Bug 166480 - gfortran: bad recyling of format in input
gfortran: bad recyling of format in input
Product: Fedora
Classification: Fedora
Component: gcc (Show other bugs)
i386 Linux
medium Severity medium
: ---
: ---
Assigned To: Jakub Jelinek
Depends On:
  Show dependency treegraph
Reported: 2005-08-22 06:58 EDT by Need Real Name
Modified: 2007-11-30 17:11 EST (History)
0 users

See Also:
Fixed In Version: 4.0.1-13
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2005-09-07 12:33:18 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)

  None (edit)
Description Need Real Name 2005-08-22 06:58:55 EDT
From Bugzilla Helper:
User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.10) Gecko/20050719 Fedora/1.7.10-1.5.1

Description of problem:
FORTRAN code compile with gfortran cycles input FORMAT in a wrong way and leads into corrputed reading. The issue is specific to gfortran: g77 does not have this problem (compat-gcc-32-g77-3.2.3-47.fc4). Here is a demonstration

This is the FORTRAN code that has this problem.

[jarioksa@biol102145 cepread]$ cat repio.f
C Input with Fortran format (I6, (T7,6F2.0))
C Where the last parenthesized part should be
C recycled.

      real vec(15)
      integer nrow, ncol

      read(5, 101) nrow, (vec(i), i=1,15)
      write(6, 104), nrow, (vec(i), i=1,15)
 101  format(i6, (t7, 6f2.0))
 104  format(i5, 15f7.1)

These are the input data:

[jarioksa@biol102145 cepread]$ cat in.dat
001    1 2 3 4 5 6
000000 7 8 9101112

(The zeros were added just to make it more readable and show that columns are correct).

Here is the result when compiled using g77: the numbers are wrong from input data line 3:

[jarioksa@biol102145 cepread]$ gfortran repio.f -o repio
[jarioksa@biol102145 cepread]$ ./repio < in.dat
    1    1.0    2.0    3.0    4.0    5.0    6.0    7.0    8.0    9.0   10.0   11.0   12.0    1.0   31.0   41.0

Here the same code compiled with g77:
[jarioksa@biol102145 cepread]$ g77 repio.f -o repio
[jarioksa@biol102145 cepread]$ ./repio < in.dat
    1    1.0    2.0    3.0    4.0    5.0    6.0    7.0    8.0    9.0   10.0   11.0   12.0   13.0   14.0   15.0

This is correct. So the problem is specific to gfortran 4.0.1.

Version-Release number of selected component (if applicable):

How reproducible:

Steps to Reproduce:
1. Compile the FORTRAN example above using gfortran.
2. Run with the input data provided.
3. See the wrong results.

Actual Results:  Data read in wrognly.

Expected Results:  Data read in correctly.

Additional info:
Comment 1 Jakub Jelinek 2005-09-03 15:14:02 EDT
Fixed in upstream GCC HEAD/gcc-4_0-branch with
Will show up in the next gcc-4.0.x rpms.
Comment 2 Jakub Jelinek 2005-09-07 12:33:18 EDT
Should be fixed in libgfortran-4.0.1-13.

Note You need to log in before you can comment on or make changes to this bug.