https://gcc.gnu.org/bugzilla/show_bug.cgi?id=123106
--- Comment #5 from Jerry DeLisle <jvdelisle at gcc dot gnu.org> --- (In reply to David Malcolm from comment #4) --- snip --- > > What would a warning ideally look like at the source level? Warning "Possible deadlock condition. Recursive I/O not permitted" and point out the line number if you can. If this analysis can be certain one could throw an error. I am not an expert in your area there for sure. Also see https://gcc.gnu.org/bugzilla/show_bug.cgi?id=30617 We know the state we are in because we always execute certain things in a certaion order. I am planning to add a flag to the gfc_unit structure. If at the beginning of a READ or WRITE statement, we will check an 'in process' flag. If it is in process, meaning a started I/O statement has not completed, we will issue a runtime error and avoid an actual deadlock. At runtime, a user can choose to monitor error status using for example the IOSTAT= variable which will suppress an error. So I need to be careful to make it a fatal error. The Fortran standards are very clear on this issue.
