https://gcc.gnu.org/bugzilla/show_bug.cgi?id=119136
--- Comment #17 from Jerry DeLisle <jvdelisle at gcc dot gnu.org> --- (In reply to Jerry DeLisle from comment #16) > (In reply to Thomas Koenig from comment #15) > > (In reply to Jerry DeLisle from comment #14) > > Regarding the logic: I think we have the potential for race conditions > > here. I would suggest something like (completely untested) > > > > Theoretically this check is done outside of locking sequences. I dont have a > problem adding a trylock and testing it. > > --- snip --- With the TRYLOCK we get a boat load of regressions. In thinking about it, I think my original patch is safe because in that section of code we are not doing any I/O, we are simply checking the flag and setting it. We are not clearing the flag until after all the I/O has completed. Regarding internal units, one can think of it as also not doing any I/O we are simply reading and writing to strings local to the program executable. I created a string version of the test case to see what it does. I get the same results as flang. I dont have another compiler set up to see what thay do with internal units. I will attach that test case.
