Skip to content

Commit 8297763

Browse files
committed
loadtxt/savetxt: export array size in error message
1 parent 9dc5cc9 commit 8297763

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/stdlib_io.fypp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ contains
167167
read (s,*,iostat=ios,iomsg=iomsg) d(i, :)
168168

169169
if (ios/=0) then
170-
write(msgout,1) trim(iomsg),i,trim(filename)
170+
write(msgout,1) trim(iomsg),size(d,2),i,trim(filename)
171171
call error_stop(msg=trim(msgout))
172172
end if
173173

@@ -178,7 +178,7 @@ contains
178178
read (s,fmt_,iostat=ios,iomsg=iomsg) d(i, :)
179179

180180
if (ios/=0) then
181-
write(msgout,1) trim(iomsg),i,trim(filename)
181+
write(msgout,1) trim(iomsg),size(d,2),i,trim(filename)
182182
call error_stop(msg=trim(msgout))
183183
end if
184184

@@ -187,7 +187,7 @@ contains
187187

188188
close(s)
189189

190-
1 format('loadtxt: error <',a,'> reading line ',i0,' of ',a,'.')
190+
1 format('loadtxt: error <',a,'> reading ',i0,' values from line ',i0,' of ',a,'.')
191191

192192
end subroutine loadtxt_${t1[0]}$${k1}$
193193
#:endfor
@@ -230,14 +230,14 @@ contains
230230
iostat=ios,iomsg=iomsg) d(i, :)
231231

232232
if (ios/=0) then
233-
write(msgout,1) trim(iomsg),i,trim(filename)
233+
write(msgout,1) trim(iomsg),size(d,2),i,trim(filename)
234234
call error_stop(msg=trim(msgout))
235235
end if
236236

237237
end do
238238
close(s)
239239

240-
1 format('savetxt: error <',a,'> writing line ',i0,' of ',a,'.')
240+
1 format('savetxt: error <',a,'> writing ',i0,' values to line ',i0,' of ',a,'.')
241241

242242
end subroutine savetxt_${t1[0]}$${k1}$
243243
#:endfor

0 commit comments

Comments
 (0)