https://gcc.gnu.org/bugzilla/show_bug.cgi?id=127724
--- Comment #1 from Mikael Morin <mikael at gcc dot gnu.org> ---
(In reply to Mikael Morin from comment #0)
> st.cc contains:
> 449 /* Insert the deallocation code before the END TEAM
> statement.
> */
> 450 last_stmt = gfc_current_ns->code;
> 451 while (last_stmt)
> 452 {
> 453 last_stmt = last_stmt->next;
> 454 if (last_stmt->next->op == EXEC_END_TEAM ||
> !last_stmt->next)
> 455 {
>
> In the "if", last_stmt->next is checked after it is accessed. Oops...
> I guess the first part of it should be last_stmt->op == EXEC_END_TEAM.
Well, no; the point is to insert something last between last_stmt and
last_stmt->next. So the two || operands should be exchanged.