Bug 19352 - Recursive IO functions are not allowed (F2003)
Summary: Recursive IO functions are not allowed (F2003)
Alias: None
Product: gcc
Classification: Unclassified
Component: fortran (show other bugs)
Version: 4.0.0
: P2 enhancement
Target Milestone: 4.1.0
Assignee: Not yet assigned to anyone
Depends on: 14943
Blocks: F2003
  Show dependency treegraph
Reported: 2005-01-09 22:50 UTC by Andrew Pinski
Modified: 2005-12-30 19:00 UTC (History)
1 user (show)

See Also:
Known to work:
Known to fail:
Last reconfirmed: 2005-09-18 05:31:07


Note You need to log in before you can comment on or make changes to this bug.
Description Andrew Pinski 2005-01-09 22:50:46 UTC
In this is both a fortran and a libfortran problem.

Take the following code and try to run it and you will get an internal error:
module mymod
  function mystring ()
    character(len=4) :: mystring
    write (unit=mystring,fmt='(A)') 'aaaa'
  end function mystring
end module mymod

program main
  use mymod
  write (unit=*,fmt='(A)') mystring()
end program main
Comment 1 Andrew Pinski 2005-01-09 22:53:28 UTC
If I remember correctly to fix this correctly you also need to fix PR 14943.
Comment 2 Paul Brook 2005-01-10 01:28:07 UTC
This is a f2003 feature, and not legal f95.

Comment 3 Thomas Koenig 2005-01-12 08:19:10 UTC
I think the error message can be improved.

Disallowing recursive I/O is not an "internal error".

What about "Calling I/O from function in I/O list not allowed" ?
Comment 4 Andrew Pinski 2005-12-30 19:00:00 UTC
Fixed in 4.1.0.