[Bug fortran/83436] Internal file cannot be accessed by UNFORMATTED data transfer when reading from /dev/urandom

2017-12-21 Thread tkoenig at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83436

--- Comment #17 from Thomas Koenig  ---
The fix will be in gcc 7.3 which is planned for release during the third week
of January according to https://gcc.gnu.org/ml/gcc/2017-12/msg00102.html .

[Bug fortran/83436] Internal file cannot be accessed by UNFORMATTED data transfer when reading from /dev/urandom

2017-12-21 Thread daanvanvugt at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83436

--- Comment #16 from Daan van Vugt  ---
Thanks guys :) What version will this be included in?

On Thu, Dec 21, 2017 at 11:36 AM, tkoenig at gcc dot gnu.org <
gcc-bugzi...@gcc.gnu.org> wrote:

> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83436
>
> Thomas Koenig  changed:
>
>What|Removed |Added
> 
> 
>  Status|WAITING |RESOLVED
>  Resolution|--- |FIXED
>
> --- Comment #15 from Thomas Koenig  ---
> Test case committed to trunk and gcc-7, closing.
>
> --
> You are receiving this mail because:
> You reported the bug.
>

[Bug fortran/83436] Internal file cannot be accessed by UNFORMATTED data transfer when reading from /dev/urandom

2017-12-21 Thread tkoenig at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83436

Thomas Koenig  changed:

   What|Removed |Added

 Status|WAITING |RESOLVED
 Resolution|--- |FIXED

--- Comment #15 from Thomas Koenig  ---
Test case committed to trunk and gcc-7, closing.

[Bug fortran/83436] Internal file cannot be accessed by UNFORMATTED data transfer when reading from /dev/urandom

2017-12-21 Thread tkoenig at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83436

--- Comment #14 from Thomas Koenig  ---
Author: tkoenig
Date: Thu Dec 21 10:34:35 2017
New Revision: 255940

URL: https://gcc.gnu.org/viewcvs?rev=255940=gcc=rev
Log:
2017-12-21  Thomas Koenig  

Backport from trunk
PR fortran/83436
* gfortran.dg/internal_readwrite_4.f90: New test.


Added:
branches/gcc-7-branch/gcc/testsuite/gfortran.dg/internal_readwrite_4.f90
Modified:
branches/gcc-7-branch/gcc/testsuite/ChangeLog

[Bug fortran/83436] Internal file cannot be accessed by UNFORMATTED data transfer when reading from /dev/urandom

2017-12-20 Thread tkoenig at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83436

--- Comment #13 from Thomas Koenig  ---
Author: tkoenig
Date: Wed Dec 20 20:36:22 2017
New Revision: 255902

URL: https://gcc.gnu.org/viewcvs?rev=255902=gcc=rev
Log:
2017-12-20  Thomas Koenig  

PR fortran/83436
* gfortran.dg/internal_readwrite_4.f90: New test.


Added:
trunk/gcc/testsuite/gfortran.dg/internal_readwrite_4.f90
Modified:
trunk/gcc/testsuite/ChangeLog

[Bug fortran/83436] Internal file cannot be accessed by UNFORMATTED data transfer when reading from /dev/urandom

2017-12-20 Thread tkoenig at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83436

--- Comment #12 from Thomas Koenig  ---
This also does not occur with 20171219.

So, my guess would be that this was a side-effect of one of
the recent patches, and was fixed in the meantime.

I will commit a test case and then close this as FIXED.

[Bug fortran/83436] Internal file cannot be accessed by UNFORMATTED data transfer when reading from /dev/urandom

2017-12-19 Thread tkoenig at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83436

--- Comment #11 from Thomas Koenig  ---
The problem went away after updating to a clean trunk,
re-bootstrapping and installing.

Let's try gcc-7 next...

[Bug fortran/83436] Internal file cannot be accessed by UNFORMATTED data transfer when reading from /dev/urandom

2017-12-19 Thread daanvanvugt at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83436

--- Comment #10 from Daan van Vugt  ---
(In reply to Steve Kargl from comment #8)
> Thanks.  Can you add the -v option to the above command line
> and report the output (up to the ld line)?  Do you have 
> more than one version of gfortran installed?

No other versions of fortran are installed.

Driving: gfortran -v -g read_urandom.f90 -o read_urandom -l gfortran -l m
-shared-libgcc
Using built-in specs.
COLLECT_GCC=gfortran
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-pc-linux-gnu/7.2.1/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: /build/gcc/src/gcc/configure --prefix=/usr --libdir=/usr/lib
--libexecdir=/usr/lib --mandir=/usr/share/man --infodir=/usr/share/info
--with-bugurl=https://bugs.archlinux.org/
--enable-languages=c,c++,ada,fortran,go,lto,objc,obj-c++ --enable-shared
--enable-threads=posix --enable-libmpx --with-system-zlib --with-isl
--enable-__cxa_atexit --disable-libunwind-exceptions --enable-clocale=gnu
--disable-libstdcxx-pch --disable-libssp --enable-gnu-unique-object
--enable-linker-build-id --enable-lto --enable-plugin
--enable-install-libiberty --with-linker-hash-style=gnu
--enable-gnu-indirect-function --enable-multilib --disable-werror
--enable-checking=release --enable-default-pie --enable-default-ssp
Thread model: posix
gcc version 7.2.1 20171128 (GCC) 
COLLECT_GCC_OPTIONS='-v' '-g' '-o' 'read_urandom' '-shared-libgcc'
'-mtune=generic' '-march=x86-64'
 /usr/lib/gcc/x86_64-pc-linux-gnu/7.2.1/f951 read_urandom.f90 -quiet -dumpbase
read_urandom.f90 -mtune=generic -march=x86-64 -auxbase read_urandom -g -version
-fintrinsic-modules-path /usr/lib/gcc/x86_64-pc-linux-gnu/7.2.1/finclude -o
/tmp/ccSKp3n4.s
GNU Fortran (GCC) version 7.2.1 20171128 (x86_64-pc-linux-gnu)
compiled by GNU C version 7.2.1 20171128, GMP version 6.1.2, MPFR
version 3.1.6-p1, MPC version 1.0.3, isl version isl-0.18-GMP

GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
GNU Fortran2008 (GCC) version 7.2.1 20171128 (x86_64-pc-linux-gnu)
compiled by GNU C version 7.2.1 20171128, GMP version 6.1.2, MPFR
version 3.1.6-p1, MPC version 1.0.3, isl version isl-0.18-GMP

GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
COLLECT_GCC_OPTIONS='-v' '-g' '-o' 'read_urandom' '-shared-libgcc'
'-mtune=generic' '-march=x86-64'
 as -v --64 -o /tmp/ccNuPWq3.o /tmp/ccSKp3n4.s
GNU assembler version 2.29.1 (x86_64-pc-linux-gnu) using BFD version (GNU
Binutils) 2.29.1
Reading specs from
/usr/lib/gcc/x86_64-pc-linux-gnu/7.2.1/../../../../lib/libgfortran.spec
rename spec lib to liborig
COLLECT_GCC_OPTIONS='-v' '-g' '-o' 'read_urandom' '-shared-libgcc'
'-mtune=generic' '-march=x86-64'
COMPILER_PATH=/usr/lib/gcc/x86_64-pc-linux-gnu/7.2.1/:/usr/lib/gcc/x86_64-pc-linux-gnu/7.2.1/:/usr/lib/gcc/x86_64-pc-linux-gnu/:/usr/lib/gcc/x86_64-pc-linux-gnu/7.2.1/:/usr/lib/gcc/x86_64-pc-linux-gnu/
LIBRARY_PATH=/usr/lib/gcc/x86_64-pc-linux-gnu/7.2.1/:/usr/lib/gcc/x86_64-pc-linux-gnu/7.2.1/../../../../lib/:/lib/../lib/:/usr/lib/../lib/:/usr/lib/gcc/x86_64-pc-linux-gnu/7.2.1/../../../:/lib/:/usr/lib/
COLLECT_GCC_OPTIONS='-v' '-g' '-o' 'read_urandom' '-shared-libgcc'
'-mtune=generic' '-march=x86-64'
 /usr/lib/gcc/x86_64-pc-linux-gnu/7.2.1/collect2 -plugin
/usr/lib/gcc/x86_64-pc-linux-gnu/7.2.1/liblto_plugin.so
-plugin-opt=/usr/lib/gcc/x86_64-pc-linux-gnu/7.2.1/lto-wrapper
-plugin-opt=-fresolution=/tmp/ccwPVEu2.res -plugin-opt=-pass-through=-lgcc_s
-plugin-opt=-pass-through=-lgcc -plugin-opt=-pass-through=-lquadmath
-plugin-opt=-pass-through=-lm -plugin-opt=-pass-through=-lgcc_s
-plugin-opt=-pass-through=-lgcc -plugin-opt=-pass-through=-lc
-plugin-opt=-pass-through=-lgcc_s -plugin-opt=-pass-through=-lgcc --build-id
--eh-frame-hdr --hash-style=gnu -m elf_x86_64 -dynamic-linker
/lib64/ld-linux-x86-64.so.2 -pie -o read_urandom
/usr/lib/gcc/x86_64-pc-linux-gnu/7.2.1/../../../../lib/Scrt1.o
/usr/lib/gcc/x86_64-pc-linux-gnu/7.2.1/../../../../lib/crti.o
/usr/lib/gcc/x86_64-pc-linux-gnu/7.2.1/crtbeginS.o
-L/usr/lib/gcc/x86_64-pc-linux-gnu/7.2.1
-L/usr/lib/gcc/x86_64-pc-linux-gnu/7.2.1/../../../../lib -L/lib/../lib
-L/usr/lib/../lib -L/usr/lib/gcc/x86_64-pc-linux-gnu/7.2.1/../../..
/tmp/ccNuPWq3.o -lgfortran -lm -lgcc_s -lgcc -lquadmath -lm -lgcc_s -lgcc -lc
-lgcc_s -lgcc /usr/lib/gcc/x86_64-pc-linux-gnu/7.2.1/crtendS.o
/usr/lib/gcc/x86_64-pc-linux-gnu/7.2.1/../../../../lib/crtn.o
COLLECT_GCC_OPTIONS='-v' '-g' '-o' 'read_urandom' '-shared-libgcc'
'-mtune=generic' '-march=x86-64'

[Bug fortran/83436] Internal file cannot be accessed by UNFORMATTED data transfer when reading from /dev/urandom

2017-12-18 Thread tkoenig at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83436

--- Comment #9 from Thomas Koenig  ---
I am also seeing this.

However, we have made some incompatible changes in the development phase
of gcc-8. (We bumped the library version only once).

This behavior could be the result of one of these changes,
if the library is not in sync with the front end.

I'll run a clean bootstrap and then try if the problem persists.

[Bug fortran/83436] Internal file cannot be accessed by UNFORMATTED data transfer when reading from /dev/urandom

2017-12-18 Thread sgk at troutmask dot apl.washington.edu
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83436

--- Comment #8 from Steve Kargl  ---
On Mon, Dec 18, 2017 at 08:00:57PM +, daanvanvugt at gmail dot com wrote:
> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83436
> 
> --- Comment #7 from Daan van Vugt  ---
> (In reply to kargl from comment #6)
> > That is not gfortran.  What happens if (1) you remove all of the
> > options and (2) you actually invoke gfortran?
> 
> gfortran -g read_urandom.f90 -o read_urandom
> 
> ./read_urandom
> At line 16 of file read_urandom.f90
> Fortran runtime error: Internal file cannot be accessed by UNFORMATTED data
> transfer
> [backtrace]
> 
> gfortran --version
> GNU Fortran (GCC) 7.2.1 20171128
> 

Thanks.  Can you add the -v option to the above command line
and report the output (up to the ld line)?  Do you have 
more than one version of gfortran installed?

[Bug fortran/83436] Internal file cannot be accessed by UNFORMATTED data transfer when reading from /dev/urandom

2017-12-18 Thread daanvanvugt at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83436

--- Comment #7 from Daan van Vugt  ---
(In reply to kargl from comment #6)
> That is not gfortran.  What happens if (1) you remove all of the
> options and (2) you actually invoke gfortran?

gfortran -g read_urandom.f90 -o read_urandom

./read_urandom
At line 16 of file read_urandom.f90
Fortran runtime error: Internal file cannot be accessed by UNFORMATTED data
transfer
[backtrace]

gfortran --version
GNU Fortran (GCC) 7.2.1 20171128

[Bug fortran/83436] Internal file cannot be accessed by UNFORMATTED data transfer when reading from /dev/urandom

2017-12-18 Thread kargl at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83436

kargl at gcc dot gnu.org changed:

   What|Removed |Added

 CC||kargl at gcc dot gnu.org

--- Comment #6 from kargl at gcc dot gnu.org ---
(In reply to Daan van Vugt from comment #5)
> Okay, turned out I missed the critical lines in my bug report...
> Could you try again with this example?
> 

WORKSFORME, but then again I use gfortan.

> 
> I have compiled it as:
> mpif90 -march=native -cpp -fopenmp -Wall -Wextra -Wno-unused-variable -g -Og
  ^^

That is not gfortran.  What happens if (1) you remove all of the
options and (2) you actually invoke gfortran?

[Bug fortran/83436] Internal file cannot be accessed by UNFORMATTED data transfer when reading from /dev/urandom

2017-12-18 Thread daanvanvugt at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83436

--- Comment #5 from Daan van Vugt  ---
Okay, turned out I missed the critical lines in my bug report...
Could you try again with this example?


module mod_random_seed
  implicit none
contains
  !> Read an int from /dev/urandom
  subroutine read_urandom_int(seed, ierr)
implicit none
integer, intent(out) :: seed
integer, intent(out) :: ierr
integer :: un
character(len=80) :: restart_file
write(restart_file,'(A,A)') 'jorek', '_restart.h5'

open(newunit=un, file="/dev/urandom", access="stream", &
form="unformatted", action="read", status="old", iostat=ierr)
if (ierr == 0) then
  read(un) seed
  close(un)
end if
  end subroutine read_urandom_int
end module mod_random_seed

program test_random_seed
  use mod_random_seed
  integer :: seed, ierr
  call read_urandom_int(seed, ierr)
  write(*,*) seed, ierr
end program test_random_seed



I have compiled it as:
mpif90 -march=native -cpp -fopenmp -Wall -Wextra -Wno-unused-variable -g -Og
-ggdb -Wunused-variable -Wintrinsics-std -Wcharacter-truncation -Wsurprising
-Wno-tabs -ffree-line-length-none -fcheck=all -ffpe-trap=invalid,zero,overflow
-ftrapv -finit-real=snan -finit-integer=12345678 -Wimplicit-interface
-Wimplicit-procedure -Wconversion -fimplicit-none read_urandom.f90 -o
read_urandom

This produces for me:
At line 16 of file read_urandom.f90
Fortran runtime error: Internal file cannot be accessed by UNFORMATTED data
transfer

Error termination. Backtrace:
#0  0x14fc70240043 in data_transfer_init
at /build/gcc/src/gcc/libgfortran/io/transfer.c:2822
#1  0x55c83ae10e31 in __mod_random_seed_MOD_read_urandom_int
at
/media/data/Projects/gfortran/bugs/internal_file_urandom/read_urandom.f90:16
#2  0x55c83ae10ebd in test_random_seed
at
/media/data/Projects/gfortran/bugs/internal_file_urandom/read_urandom.f90:25
#3  0x55c83ae10f63 in main
at
/media/data/Projects/gfortran/bugs/internal_file_urandom/read_urandom.f90:23

[Bug fortran/83436] Internal file cannot be accessed by UNFORMATTED data transfer when reading from /dev/urandom

2017-12-15 Thread dominiq at lps dot ens.fr
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83436

Dominique d'Humieres  changed:

   What|Removed |Added

 Status|UNCONFIRMED |WAITING
   Last reconfirmed||2017-12-15
 Ever confirmed|0   |1

--- Comment #4 from Dominique d'Humieres  ---
WORKSFORME too!

[Bug fortran/83436] Internal file cannot be accessed by UNFORMATTED data transfer when reading from /dev/urandom

2017-12-15 Thread jvdelisle at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83436

--- Comment #3 from Jerry DeLisle  ---
Daan,

Works for me here. It could be that the compiler is trying to use a wrong
library version. Did you build gfortran yourself? What system are you running
on?

[Bug fortran/83436] Internal file cannot be accessed by UNFORMATTED data transfer when reading from /dev/urandom

2017-12-15 Thread jvdelisle at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83436

--- Comment #2 from Jerry DeLisle  ---
(In reply to Thomas Koenig from comment #1)
> I can not check this right. Jerry, van you take a look?

Looking

[Bug fortran/83436] Internal file cannot be accessed by UNFORMATTED data transfer when reading from /dev/urandom

2017-12-15 Thread tkoenig at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83436

Thomas Koenig  changed:

   What|Removed |Added

 CC||jvdelisle at gcc dot gnu.org,
   ||tkoenig at gcc dot gnu.org

--- Comment #1 from Thomas Koenig  ---
I can not check this right. Jerry, van you take a look?