http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59108
Bug ID: 59108 Summary: ACTION='READ' is using O_CREAT Product: gcc Version: 4.8.1 Status: UNCONFIRMED Severity: normal Priority: P3 Component: libfortran Assignee: unassigned at gcc dot gnu.org Reporter: nmm1 at cam dot ac.uk Running 'strace -v -e trace=open' on the following program: PROGRAM Main OPEN(11,FILE='wombat',ACTION='READ') OPEN(12,FILE='numbat',ACTION='READ',ACCESS='STREAM') OPEN(13,FILE='dingbat',ACTION='READ',ACCESS='DIRECT',RECL=8) END PROGRAM Main produces: open("wombat", O_RDONLY|O_CREAT, 0666) = 3 open("numbat", O_RDONLY|O_CREAT, 0666) = 4 open("dingbat", O_RDONLY|O_CREAT, 0666) = 5 Not merely does this create files when the user isn't expecting it, it fails if the directory or file system is protected against writing. wheeler$uname -a Linux wheeler 2.6.37.6-24-desktop #1 SMP PREEMPT 2012-10-18 22:36:08 +0200 x86_64 x86_64 x86_64 GNU/Linux wheeler$gfortran -v Using built-in specs. COLLECT_GCC=gfortran COLLECT_LTO_WRAPPER=/home/nmm/GCC/libexec/gcc/x86_64-unknown-linux-gnu/4.8.1/lto-wrapper Target: x86_64-unknown-linux-gnu Configured with: ../configure --prefix=/home/nmm/GCC --disable-bootstrap --enable-languages=c,c++,fortran --enable-werror=yes --disable-decimal-float Thread model: posix gcc version 4.8.1 (GCC)