https://gcc.gnu.org/bugzilla/show_bug.cgi?id=118935
--- Comment #2 from chenglulu <chenglulu at loongson dot cn> ---
However, based on the code logic, I believe that the linked list `unit_root` in
the `find_file0` function should not be modified. I'm not sure if my
understanding is correct.
```
/* find_file()-- Take the current filename and see if there is a unit
that has the file already open. Returns a pointer to the unit if so. */
gfc_unit *
find_file (const char *file, gfc_charlen_type file_len)
{
......
RDLOCK (&unit_rwlock);
retry:
u = find_file0 (unit_root, FIND_FILE0_ARGS);
if (u != NULL)
{
/* Fast path. */
if (! __gthread_mutex_trylock (&u->lock))
{
/* assert (u->closed == 0); */
RWUNLOCK (&unit_rwlock);
goto done;
}
inc_waiting_locked (u);
}
RWUNLOCK (&unit_rwlock);
```