FS#56768 - [gcc-fortran] Fortran runtime error when writing

Attached to Project: Arch Linux
Opened by Corentin Cadiou (cphyc) - Monday, 18 December 2017, 20:19 GMT
Last edited by Bartłomiej Piotrowski (Barthalion) - Thursday, 28 December 2017, 08:39 GMT
Task Type Bug Report
Category Packages: Core
Status Closed
Assigned To Bartłomiej Piotrowski (Barthalion)
Architecture All
Severity Medium
Priority Normal
Reported Version
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 0
Private No

Details

Description:

Using gcc-gfortran GNU Fortran (GCC) 7.2.1 20171128 on Arch Linux, I get a `Fortran runtime error: End of file` when trying to write to a file.

Additional info:
* GNU Fortran (GCC) 7.2.1 20171128
* the code runs well with GCC version 7.2.1 20170915 (Red Hat 7.2.1-2), see https://tio.run/##bVLBTsMwDL3vK7xySIo6tiJNQhPlgsRvTKHzRqTUqRIX2NcPp2FlAyK1dZ7t52e7ex84GFoc9tk4nfrgD8F0sPd@BjBEBBv99tu9RXoX1Ha9s61lIE84E6B9M8G0jEE7pOZhVcJmA3srF9PhH/96dFMCU7IlxgOGhFk3UFMnsA8Cw20Fre96IQrbdwzRetIlAMwX6YyVjXPAlh3qusqcpcDzbEIDaiWnVin2LEhQDrbTOXq5VHf8yWPER7CMWqoqbSooHosK0vepKFUJaspXVSY4A6mi75E04cdAlpvURzXWa64DBfSha1R6G2bcCVVkw0NsVMDemRZVOQnJNKKlrkx9L89q1HEjSerFdNYdk/XsBxL5MgvnY04qp9HEY2TsNBStYRhHkZotoPwZItIOLrc@i8Nr8ANbwu/J0sVkr3c/ba8aDWJtKW/3n61PMUJ@8Qucux1vqV27ulunRilr@y3ndPoC
* the code runs well with ifort (IFORT) 18.0.1 20171018 on CentOS release 6.9
* the code runs well with GNU Fortran (GCC) 6.4.1 20171003 on Arch Linux

Steps to reproduce:
1. Compile the file using `gfortran foo.f90 -o foo`
2. Execute the binary file `./foo`
3. It should create a file named `00001.txt` containing `# Family Count`.

Trace:
```
filename <00001.txt>
At line 16 of file foo.f90
Fortran runtime error: End of file

Error termination. Backtrace:
#0 0x7fc7ed2d6cac in formatted_transfer_scalar_write
at /build/gcc/src/gcc/libgfortran/io/transfer.c:2059
#1 0x7fc7ed2d6e4c in formatted_transfer
at /build/gcc/src/gcc/libgfortran/io/transfer.c:2279
#2 0x5576dad65fa8 in ???
#3 0x5576dad66081 in ???
#4 0x7fc7ec606f49 in ???
#5 0x5576dad65a99 in ???
#6 0xffffffffffffffff in ???
```
This task depends upon

Closed by  Bartłomiej Piotrowski (Barthalion)
Thursday, 28 December 2017, 08:39 GMT
Reason for closing:  Fixed
Additional comments about closing:  gcc 7.2.1+20171224-1
Comment by Corentin Cadiou (cphyc) - Monday, 18 December 2017, 20:20 GMT
Here's the source code.
   foo.f90 (1.7 KiB)

Loading...