https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100300
Bug ID: 100300 Summary: compile-time infinite loop if using execute_command_line Product: gcc Version: 10.2.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: fortran Assignee: unassigned at gcc dot gnu.org Reporter: john.harper at vuw dot ac.nz Target Milestone: --- The program writetest.f90 below writes a file and then uses execute_command_line to compile readtest.f90, which was supposed to read the file, but its syntax error drove gfortran into an infinite loop pointing the error out. Linux system evidence: cayley[~/Jfh] % gfortran -v Using built-in specs. COLLECT_GCC=gfortran COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-pc-linux-gnu/10.2.0/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++,d --with-isl --with-linker-hash-style=gnu --with-system-zlib --enable-__cxa_atexit --enable-cet=auto --enable-checking=release --enable-clocale=gnu --enable-default-pie --enable-default-ssp --enable-gnu-indirect-function --enable-gnu-unique-object --enable-install-libiberty --enable-linker-build-id --enable-lto --enable-multilib --enable-plugin --enable-shared --enable-threads=posix --disable-libssp --disable-libstdcxx-pch --disable-libunwind-exceptions --disable-werror gdc_include_dir=/usr/include/dlang/gdc Thread model: posix Supported LTO compression algorithms: zlib zstd gcc version 10.2.0 (GCC) cayley[~/Jfh] % cat writetest.f90 ! Use execute_command_line to start a second program readtest.f90 that ! reads a file, testfile.txt, written by this program. implicit none integer u,i open(newunit=u,file='testfile.txt',action='WRITE',position='REWIND',& form='FORMATTED',access='SEQUENTIAL') write(u,"(A,I0)") ('line ',i,i=1,2) call execute_command_line('gfortran readtest.f90 ; ./a.out') end program cayley[~/Jfh] % cat readtest.f90 implicit none character(40) lines(2) integer u open(newunit=u,,file='testfile.txt') read(u,"(A)") lines(:) print "(A)",'readtest gave '//lines(:) end program The second program has a syntax error (,,) correctly found by gfortran but compiling it by calling execute_command_line in the first program gave an infinite loop repeating this 5-line message until I stopped it manually: ----quote-------------------------------------- readtest.f90:4:18: 4 | open(newunit=u,,file='testfile.txt') | 1 Error: Syntax error in OPEN statement at (1) ----unquote------------------------------------ Correcting the error by removing one of the commas made the program compile and run.