gfxgfx
 
Please login or register.

Login with username, password and session length
 
gfx gfx
gfx
1490 Posts in 492 Topics by 716 Members - Latest Member: paul.macmillan July 21, 2019, 06:48:51 AM
*
gfx* Home | Help | Search | Login | Register | gfx
gfx
Absoft User Forum  |  Support  |  Windows  |  Internal Write error not detected
gfx
gfxgfx
 

Author Topic: Internal Write error not detected  (Read 66 times)

mecej4

  • Jr. Member
  • **
  • Posts: 60
Internal Write error not detected
« on: July 07, 2019, 08:23:47 AM »
The following program does formatted writes of an integer to an internal file (i.e., a buffer) with three  different variations. The second WRITE writes using a field width of 4, which is adequate for the integer 123, but the resulting string is longer than the record length of the internal file, which is 3.


I think that the second WRITE should yield a positive IOSTAT value, a suitable IOMSG, and leave the record unchanged. Absoft Fortran returns IOSTAT = 0, instead, and the written record is incorrect.
Code: [Select]
program asterisks
  character(3) str
  character(100) msg
  n=123
  print *,'Str Iostat Message'
  str='xyz'; msg=' - '; write(str,'(i0)',iostat=i,iomsg=msg) n
  write(*,10) str,i,trim(msg)
  str='xyz'; msg=' - '; write(str,'(i4)',iostat=i,iomsg=msg) n
  write(*,10) str,i,trim(msg)
  str='xyz'; msg=' - '; write(str,'(i2)',iostat=i,iomsg=msg) n
  write(*,10) str,i,trim(msg)
10 format(1x,A3,i5,4x,A)
end

Intel Fortran gives:

Code: [Select]
Str Iostat Message
 123    0     -
       66    output statement overflows record, unit -5, file Internal Formatted Write
 **     0
« Last Edit: July 09, 2019, 10:29:45 AM by mecej4 »

forumadmin

  • Administrator
  • Sr. Member
  • *****
  • Posts: 297
Re: Internal Write error not detected
« Reply #1 on: July 09, 2019, 12:45:59 PM »
The relevant portion of the Fortran standards agree with you. An error should be reported if there is an attempt to transfer more characters than the length of an internal file.  This has been filed as a bug in the run time library for the next service pack.

Absoft User Forum  |  Support  |  Windows  |  Internal Write error not detected
 

gfxgfx
gfx gfx
Powered by MySQL Powered by PHP Valid XHTML 1.0! Valid CSS!