https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104329
--- Comment #2 from Tobias Burnus <burnus at gcc dot gnu.org> --- The problem is related to x = ['123'] generates the AST ASSIGN z1:_F.DA0(FULL) (parens z1:x(FULL)) ASSIGN z1:x(FULL) z1:_F.DA0(FULL) The following should fix it - at least it fixes the three examples by erroring out with: Error: !$OMP ATOMIC statement must set a scalar variable of intrinsic type at (1) --- a/gcc/fortran/openmp.cc +++ b/gcc/fortran/openmp.cc @@ -7690 +7690 @@ resolve_omp_atomic (gfc_code *code) - gfc_code *stmt = NULL, *capture_stmt = NULL; + gfc_code *stmt = NULL, *capture_stmt = NULL, *tailing_stmt = NULL; @@ -7828 +7828,2 @@ resolve_omp_atomic (gfc_code *code) - gcc_assert (!code->next->next); + /* Shall be NULL but can happen for invalid code. */ + tailing_stmt = code->next->next; @@ -7836 +7837,2 @@ resolve_omp_atomic (gfc_code *code) - gcc_assert (!code->next); + /* Shall be NULL but can happen for invalid code. */ + tailing_stmt = code->next; @@ -7888,0 +7891,3 @@ resolve_omp_atomic (gfc_code *code) + /* Should be diagnosed above already. */ + gcc_assert (tailing_stmt == NULL); +