Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
Announcements
Welcome to the Intel Community. If you get an answer you like, please mark it as an Accepted Solution to help others. Thank you!
26731 Discussions

Bug in Intel 2019u1 with INQUIRE and WRITE

Jacob_Williams
New Contributor I
139 Views

I'm seeing a bug in Intel 2019u1 (after updating from 2017u4). The following is a very stripped-down example that shows the problem:

program main
		
  implicit none
  
  integer :: file_id,iostatus
  logical :: status_flag
  character(len=:),allocatable :: str
  
  file_id = 1003
  
  open(unit=file_id,file='test.txt',status='REPLACE',iostat=iostatus)
  
  str = '1'
  inquire(unit=file_id, opened=status_flag, iostat=iostatus)	
  write(file_id,fmt='(A)',advance='NO',iostat=iostatus) str		
  
  str = '2'
  inquire(unit=file_id, opened=status_flag, iostat=iostatus)			
  write(file_id,fmt='(A)',advance='NO',iostat=iostatus) str		
  
  str = '3'
  inquire(unit=file_id, opened=status_flag, iostat=iostatus)		
  write(file_id,fmt='(A)',advance='NO',iostat=iostatus) str
  
  close(unit=file_id)
			
end program main

The contents of the resulting file should be "123", but I'm getting only "3". If I comment out the INQUIRE calls, it works as expected. It seems like the INQUIREs are interfering with or preventing some of the WRITE statements in some way.

I'm using the 64 bit compiler on Windows 10. Same results for both Debug and Release builds.

0 Kudos
2 Replies
Johannes_Rieke
New Contributor III
139 Views

Hi Jacob, I can confirm that behavior for PSXE2018u3 and PSXE2019u1. PSXE2017u6 works as expected with inquire present. Gfortran 8.2.1 delivers also '123'. It would be good to open a ticket at OSC to get the Intel team informed.

BR, Johannes

Jacob_Williams
New Contributor I
139 Views

Done (Support request number 03934032)

Reply