https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104328
--- Comment #2 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
The first 2 testcases can be fixed with
--- openmp.cc.jj2 2022-01-21 11:01:12.458449420 +0100
+++ openmp.cc 2022-02-02 16:21:36.813563894 +0100
@@ -7757,6 +7757,7 @@ resolve_omp_atomic (gfc_code *code)
if (code->op == EXEC_IF
&& code->block
&& code->block->op == EXEC_IF
+ && code->block->next
&& code->block->next->op == EXEC_ASSIGN)
{
comp_cond = code->block->expr1;
The last 3 need other fixes.